{"_id":"@arraypress/stripe-currencies","_rev":"3-8d2bfddc1b58dac425cb89170abd4fbe","name":"@arraypress/stripe-currencies","dist-tags":{"latest":"2.2.0"},"versions":{"2.0.0":{"name":"@arraypress/stripe-currencies","version":"2.0.0","keywords":["stripe","currency","format","money","payments"],"author":{"name":"David Sherlock"},"license":"MIT","_id":"@arraypress/stripe-currencies@2.0.0","maintainers":[{"name":"arraypress","email":"davidmichaelsherlock@icloud.com"}],"homepage":"https://github.com/arraypress/stripe-currencies#readme","bugs":{"url":"https://github.com/arraypress/stripe-currencies/issues"},"dist":{"shasum":"8c1dbf3dcdeb0220a249f7e289d60403dfe12b1e","tarball":"https://registry.npmjs.org/@arraypress/stripe-currencies/-/stripe-currencies-2.0.0.tgz","fileCount":6,"integrity":"sha512-yRl3YjEz+ZjCaBJZr0x3tkd/rakWnwMIUEBn8FmwIiUunFuNblfMvGNzvMhwNEzEdr333dK/zWLGT7g5Js/uCQ==","signatures":[{"sig":"MEUCIEH19nx+64s1VyFBPCd/PCQLIVU8eWBDtTxEr0q8OS+CAiEA6f2CCLbOP2tXtPew1fVG8Vm0VXQVE5giuW2aEUUWfdU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29895},"main":"src/index.js","type":"module","types":"src/index.d.ts","exports":{".":{"types":"./src/index.d.ts","import":"./src/index.js"}},"gitHead":"5d0a25b5d394e15134478f13f18b4ab52e48d1de","scripts":{"test":"node --test tests/stripe-currencies.test.js"},"_npmUser":{"name":"arraypress","email":"davidmichaelsherlock@icloud.com"},"repository":{"url":"git+https://github.com/arraypress/stripe-currencies.git","type":"git"},"_npmVersion":"11.11.0","description":"Stripe currency formatting, conversion, and validation. All 136 currencies.","directories":{},"_nodeVersion":"25.8.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/stripe-currencies_2.0.0_1774434704659_0.5574529864018343","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@arraypress/stripe-currencies","version":"2.1.0","keywords":["stripe","currency","format","money","payments"],"author":{"name":"David Sherlock"},"license":"MIT","_id":"@arraypress/stripe-currencies@2.1.0","maintainers":[{"name":"arraypress","email":"davidmichaelsherlock@icloud.com"}],"homepage":"https://github.com/arraypress/stripe-currencies#readme","bugs":{"url":"https://github.com/arraypress/stripe-currencies/issues"},"dist":{"shasum":"b7759470836fb547ea91fe0c0b3ce0d9e57630eb","tarball":"https://registry.npmjs.org/@arraypress/stripe-currencies/-/stripe-currencies-2.1.0.tgz","fileCount":6,"integrity":"sha512-UElaBPoKNllFQKvFYmHRXW3URrZ65iigAPw6mpDPvM/dDCeRFRib76H3v5ZzUvERvFaAsh8g12CIO+N15/A4FA==","signatures":[{"sig":"MEQCIEo8QF93mZ34fiI4voC70pxaSPxeooqEKnipFNNAKUUqAiAeCEfrcDqJu+ZkFfAlCIP1GS/WDGl2+JY199L0dHFqOQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33230},"main":"src/index.js","type":"module","types":"src/index.d.ts","exports":{".":{"types":"./src/index.d.ts","import":"./src/index.js"}},"gitHead":"cbf798892a150be8cd279539c32cf1769376395f","scripts":{"test":"node --test tests/stripe-currencies.test.js"},"_npmUser":{"name":"arraypress","email":"davidmichaelsherlock@icloud.com"},"repository":{"url":"git+https://github.com/arraypress/stripe-currencies.git","type":"git"},"_npmVersion":"11.11.1","description":"Stripe currency formatting, conversion, and validation. All 136 currencies.","directories":{},"_nodeVersion":"25.8.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/stripe-currencies_2.1.0_1774621764519_0.9781073325869771","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"@arraypress/stripe-currencies","version":"2.2.0","description":"Stripe currency formatting, conversion, and validation. All 136 currencies.","type":"module","main":"src/index.js","types":"src/index.d.ts","exports":{".":{"import":"./src/index.js","types":"./src/index.d.ts"}},"scripts":{"test":"node --test tests/stripe-currencies.test.js"},"keywords":["stripe","currency","format","money","payments"],"author":{"name":"David Sherlock"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/arraypress/stripe-currencies.git"},"gitHead":"b93374717c560bf57b5aadb51d52fe5b38cd99f5","_id":"@arraypress/stripe-currencies@2.2.0","bugs":{"url":"https://github.com/arraypress/stripe-currencies/issues"},"homepage":"https://github.com/arraypress/stripe-currencies#readme","_nodeVersion":"25.8.2","_npmVersion":"11.11.1","dist":{"integrity":"sha512-7DgF976miLUMekP8pz4IiIAlHcidtpF3EicF4jwRg/y29AEcppXzJ1C8Y4cD7HLGlUXUBbnQ9BXMzMtF5ehgog==","shasum":"2ad5f9052cd15b275ca56b5480e44888cae2296e","tarball":"https://registry.npmjs.org/@arraypress/stripe-currencies/-/stripe-currencies-2.2.0.tgz","fileCount":6,"unpackedSize":37736,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD/ADgPfbwe5hE1dZPtnfSB5ShVfbemBSL6H79pdqVgYAIhAO8DpfVMXOSeq6wJKy2jrLvCVAVev2qv31Gf3DuZQTwN"}]},"_npmUser":{"name":"arraypress","email":"davidmichaelsherlock@icloud.com"},"directories":{},"maintainers":[{"name":"arraypress","email":"davidmichaelsherlock@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/stripe-currencies_2.2.0_1775382493150_0.6516282627429069"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-25T10:31:44.531Z","modified":"2026-04-05T09:48:13.459Z","2.0.0":"2026-03-25T10:31:44.798Z","2.1.0":"2026-03-27T14:29:24.698Z","2.2.0":"2026-04-05T09:48:13.338Z"},"bugs":{"url":"https://github.com/arraypress/stripe-currencies/issues"},"author":{"name":"David Sherlock"},"license":"MIT","homepage":"https://github.com/arraypress/stripe-currencies#readme","keywords":["stripe","currency","format","money","payments"],"repository":{"type":"git","url":"git+https://github.com/arraypress/stripe-currencies.git"},"description":"Stripe currency formatting, conversion, and validation. All 136 currencies.","maintainers":[{"name":"arraypress","email":"davidmichaelsherlock@icloud.com"}],"readme":"# @arraypress/stripe-currencies\n\nStripe currency formatting, conversion, and validation. All 136 Stripe-supported currencies with correct symbols,\ndecimal handling, and display names.\n\nZero dependencies. Works in Node.js, Cloudflare Workers, Deno, Bun, and browsers.\n\n## Installation\n\n```bash\nnpm install @arraypress/stripe-currencies\n```\n\n## Usage\n\n```js\nimport {format, formatRecurring, formatPlain, formatWithCode} from '@arraypress/stripe-currencies';\n\n// All amounts are in smallest unit (cents) — as Stripe returns them\n\n// Format with symbol\nformat(1999, 'usd')     // 'US$19.99'\nformat(1500, 'gbp')     // '£15.00'\nformat(1000, 'jpy')     // '¥1,000'      (zero-decimal)\nformat(5000, 'bhd')     // 'BD5.000'     (three-decimal)\nformat(-1999, 'usd')    // '-US$19.99'\n\n// Recurring/subscription prices\nformatRecurring(999, 'usd', 'month')       // 'US$9.99/mo'\nformatRecurring(2999, 'usd', 'year')       // 'US$29.99/yr'\nformatRecurring(999, 'usd', 'month', 3)    // 'US$9.99 every 3 months'\n\n// Without symbol\nformatPlain(1999, 'usd')      // '19.99'\n\n// With code\nformatWithCode(1999, 'usd')   // '19.99 USD'\n```\n\n## API\n\n### Formatting\n\nAll formatting functions take `amount` in the **smallest unit** (cents, pence, etc.) as Stripe returns.\n\n| Function                      | Example       | Result        |\n|-------------------------------|---------------|---------------|\n| `format(1999, 'usd')`         | With symbol   | `'US$19.99'`  |\n| `format(1000, 'jpy')`         | Zero-decimal  | `'¥1,000'`    |\n| `format(5000, 'bhd')`         | Three-decimal | `'BD5.000'`   |\n| `formatPlain(1999, 'usd')`    | No symbol     | `'19.99'`     |\n| `formatWithCode(1999, 'usd')` | Code suffix   | `'19.99 USD'` |\n\n### Recurring Prices\n\nFormat subscription/recurring prices with billing interval suffixes.\n\n```js\nimport {formatRecurring} from '@arraypress/stripe-currencies';\n\n// Standard intervals\nformatRecurring(999, 'usd', 'month')       // 'US$9.99/mo'\nformatRecurring(2999, 'usd', 'year')       // 'US$29.99/yr'\nformatRecurring(500, 'gbp', 'week')        // '£5.00/wk'\nformatRecurring(100, 'usd', 'day')         // 'US$1.00/day'\n\n// Custom interval counts\nformatRecurring(999, 'usd', 'month', 3)    // 'US$9.99 every 3 months'\nformatRecurring(999, 'usd', 'year', 2)     // 'US$9.99 every 2 years'\nformatRecurring(500, 'usd', 'week', 2)     // 'US$5.00 every 2 weeks'\n\n// Zero-decimal currencies\nformatRecurring(1000, 'jpy', 'month')      // '¥1,000/mo'\n\n// No interval returns plain format\nformatRecurring(999, 'usd', null)          // 'US$9.99'\n```\n\n### Currency Data\n\n```js\nimport {getSymbol, getName, getDecimals} from '@arraypress/stripe-currencies';\n\ngetSymbol('gbp')     // '£'\ngetName('eur')       // 'Euro'\ngetDecimals('jpy')   // 0\ngetDecimals('usd')   // 2\ngetDecimals('bhd')   // 3\n```\n\n### Conversion\n\nConvert between decimal amounts and Stripe's smallest unit representation.\n\n```js\nimport {toSmallestUnit, fromSmallestUnit} from '@arraypress/stripe-currencies';\n\ntoSmallestUnit(19.99, 'usd')    // 1999\ntoSmallestUnit(1000, 'jpy')     // 1000\ntoSmallestUnit(5.123, 'bhd')    // 5123\n\nfromSmallestUnit(1999, 'usd')   // 19.99\nfromSmallestUnit(1000, 'jpy')   // 1000\nfromSmallestUnit(5123, 'bhd')   // 5.123\n```\n\n### Validation\n\n```js\nimport {isSupported, isZeroDecimal} from '@arraypress/stripe-currencies';\n\nisSupported('usd')     // true\nisSupported('xyz')     // false\n\nisZeroDecimal('jpy')   // true  (JPY, KRW, VND, etc.)\nisZeroDecimal('usd')   // false\n```\n\n## Stripe Decimal Handling\n\nMost currencies use 2 decimal places. Exceptions:\n\n- **Zero-decimal (0):** JPY, KRW, CLP, PYG, VND, VUV, RWF, BIF, DJF, GNF, KMF, MGA, XAF, XOF, XPF\n- **Three-decimal (3):** BHD, KWD, OMR, JOD, TND\n- **Logically zero but Stripe uses 2:** ISK, UGX\n\n## TypeScript\n\nFull type definitions included.\n\n```ts\nimport {format, formatRecurring, isSupported} from '@arraypress/stripe-currencies';\n\nconst price: string = format(1999, 'usd');\nconst monthly: string = formatRecurring(999, 'usd', 'month');\nconst valid: boolean = isSupported('gbp');\n```\n\n## License\n\nMIT","readmeFilename":"README.md"}