{"_id":"@alef-prime/units","name":"@alef-prime/units","dist-tags":{"alpha":"0.1.0-alpha.0","latest":"0.1.0-alpha.0"},"versions":{"0.1.0-alpha.0":{"name":"@alef-prime/units","version":"0.1.0-alpha.0","description":"Locale-aware currency, distance, duration, and number formatters. Plus haversine. Battle-tested in pundak.app delivery (real money, real km).","type":"module","main":"./index.mjs","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.mjs"}},"engines":{"node":">=18"},"keywords":["currency","distance","haversine","intl","format","i18n","alef-prime"],"homepage":"https://www.n50.io/evolution","repository":{"type":"git","url":"git+https://github.com/Ilya0527/alef-prime-units.git"},"license":"MIT","author":{"name":"ALEF-PRIME","url":"Ilya Glikman"},"sideEffects":false,"gitHead":"add4a015a08c321c24b324a91e19da7513f4c922","_id":"@alef-prime/units@0.1.0-alpha.0","bugs":{"url":"https://github.com/Ilya0527/alef-prime-units/issues"},"_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-Lw6PEcUhv5Fbc/5y+7YveHOAMgJFhJR5iCaZn2j3tCoEz8lF/eYenVAIurHNr0LadI7OJdvEMcgBBL6zOnl6vg==","shasum":"7e7c744c4621a267fc81c11235950b3f656178b0","tarball":"https://registry.npmjs.org/@alef-prime/units/-/units-0.1.0-alpha.0.tgz","fileCount":4,"unpackedSize":5503,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIE2OHYMTfvUBwtpBtkN/uCvnjY2SDbrQZE87kLFg1YRNAiEA5Cy3d6mUyKjGGSNoK9dXyMJfeBkhTcm5uXX1eDUoxq4="}]},"_npmUser":{"name":"n50","email":"ilya0527@gmail.com"},"directories":{},"maintainers":[{"name":"n50","email":"ilya0527@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/units_0.1.0-alpha.0_1779107642536_0.18389220746565482"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-18T12:34:02.430Z","0.1.0-alpha.0":"2026-05-18T12:34:02.717Z","modified":"2026-05-18T12:34:03.004Z"},"maintainers":[{"name":"n50","email":"ilya0527@gmail.com"}],"description":"Locale-aware currency, distance, duration, and number formatters. Plus haversine. Battle-tested in pundak.app delivery (real money, real km).","homepage":"https://www.n50.io/evolution","keywords":["currency","distance","haversine","intl","format","i18n","alef-prime"],"repository":{"type":"git","url":"git+https://github.com/Ilya0527/alef-prime-units.git"},"author":{"name":"ALEF-PRIME","url":"Ilya Glikman"},"bugs":{"url":"https://github.com/Ilya0527/alef-prime-units/issues"},"license":"MIT","readme":"# @alef-prime/units\n\n> Locale-aware money, distance, duration. Plus haversine. Zero deps.\n\n```ts\nimport { formatMoney, formatDistance, formatDuration, haversineKm } from \"@alef-prime/units\";\n\nformatMoney(42.5, \"he\", \"ILS\");         // → \"‏42.50 ₪\"\nformatMoney(42.5, \"en\", \"USD\");         // → \"$42.50\"\nformatDistance(0.8, \"he\");              // → \"800 m\"\nformatDistance(3.4, \"he\");              // → '3.4 ק\"מ'\nformatDuration(95, \"ru\");               // → \"1ч 35мин\"\nhaversineKm({ lat: 32.07, lng: 34.78 }, { lat: 31.78, lng: 35.21 });\n// → 70.32   (Tel Aviv → Jerusalem, km)\n```\n\n## Why\n\nBattle-tested in [pundak.app](https://pundak.app) — Israeli food delivery handling real money, real km, real ETA windows. Extracted as a zero-dep package so Foresight, Backerpath, and anyone shipping in Hebrew/Russian/English can stop rewriting the same `Intl.NumberFormat` boilerplate.\n\n## API\n\n| Function | Signature | Notes |\n|---|---|---|\n| `formatMoney` | `(amount, locale=\"he\", currency=\"ILS\") → string` | Uses `Intl.NumberFormat`. Strips trailing `.00` for whole amounts. |\n| `formatDistance` | `(km, locale=\"he\") → string` | Switches to meters below 1km. RTL-safe suffix. |\n| `formatDuration` | `(minutes, locale=\"he\") → string` | \"1ש' 35ד'\" / \"1h 35m\" / \"1ч 35мин\". |\n| `haversineKm` | `({lat,lng}, {lat,lng}) → km` | Earth radius 6371. Pure trig. |\n| `formatNumber` | `(n, locale=\"he\") → string` | Thousand separators per locale. |\n\n## Status: alpha · 0.1.0\n\nBorn from [ALEF-PRIME](https://www.n50.io) cross-pollination. Sibling of [`@alef-prime/i18n-pick`](https://github.com/Ilya0527/alef-prime-i18n-pick), [`@alef-prime/deploy-verify`](https://github.com/Ilya0527/alef-prime-deploy-verify), [`@alef-prime/audit`](https://github.com/Ilya0527/alef-site/tree/main/audit). MIT.\n","readmeFilename":"README.md","_rev":"1-b0206155e7588376a254edf149fdfba9"}