{"_id":"@commerce-atoms/money","_rev":"3-11c7d11946e1c6bdd0c86194f02c9fad","name":"@commerce-atoms/money","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@commerce-atoms/money","version":"0.0.1","keywords":["shopify","hydrogen","money","price","formatting","ecommerce","utilities"],"author":{"name":"Commerce Atoms"},"license":"MIT","_id":"@commerce-atoms/money@0.0.1","maintainers":[{"name":"doctor.undefined","email":"contact@soundefined.com"}],"homepage":"https://github.com/commerce-atoms/shoppy/tree/main/packages/money","bugs":{"url":"https://github.com/commerce-atoms/shoppy/issues"},"dist":{"shasum":"32fdf90d580f371462030d612f018653fa037ee6","tarball":"https://registry.npmjs.org/@commerce-atoms/money/-/money-0.0.1.tgz","fileCount":19,"integrity":"sha512-khgTI2VeyF2RsoaS2cqsmlsUyu9tD4m/ftHAIh6CEpJOiw/aNtonSpN8iQERG+weN1BEaBKv2Cm3RMcvbw8/LA==","signatures":[{"sig":"MEUCIQDBPzpJh7eVY5+QqiYzqxKHXHHox+taI5HcmUNpsMxTqwIge9sHJcNST/YIcbSeB7Jw/WExEbLdvLrjmcu9EGsU9QY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@commerce-atoms%2fmoney@0.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":18318},"type":"module","engines":{"node":">=18.0.0"},"exports":{"./types/money":{"types":"./dist/types/money.d.ts","import":"./dist/types/money.js"},"./package.json":"./package.json","./types/compare":{"types":"./dist/types/compare.d.ts","import":"./dist/types/compare.js"},"./types/options":{"types":"./dist/types/options.d.ts","import":"./dist/types/options.js"},"./parse/parseAmount":{"types":"./dist/parse/parseAmount.d.ts","import":"./dist/parse/parseAmount.js"},"./format/formatMoney":{"types":"./dist/format/formatMoney.d.ts","import":"./dist/format/formatMoney.js"},"./format/formatRange":{"types":"./dist/format/formatRange.d.ts","import":"./dist/format/formatRange.js"},"./compare/formatCompare":{"types":"./dist/compare/formatCompare.d.ts","import":"./dist/compare/formatCompare.js"},"./compare/calculateDiscountPercent":{"types":"./dist/compare/calculateDiscountPercent.d.ts","import":"./dist/compare/calculateDiscountPercent.js"}},"gitHead":"aad0c0352718bf059706547692bab550e44b087d","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","pack:check":"npm pack --dry-run --silent","prepublishOnly":"npm run build"},"_npmUser":{"name":"doctor.undefined","email":"contact@soundefined.com"},"repository":{"url":"git+https://github.com/commerce-atoms/shoppy.git","type":"git","directory":"packages/money"},"_npmVersion":"10.9.4","description":"Pure money formatting and compare-at pricing","directories":{},"sideEffects":false,"_nodeVersion":"22.21.1","dependencies":{},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/money_0.0.1_1766431521798_0.26457088662964257","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@commerce-atoms/money","version":"0.0.2","keywords":["shopify","hydrogen","money","price","formatting","ecommerce","utilities"],"author":{"name":"Commerce Atoms"},"license":"MIT","_id":"@commerce-atoms/money@0.0.2","maintainers":[{"name":"doctor.undefined","email":"contact@soundefined.com"}],"homepage":"https://github.com/commerce-atoms/shoppy/tree/main/packages/money","bugs":{"url":"https://github.com/commerce-atoms/shoppy/issues"},"dist":{"shasum":"b8a354b28fe0f2801674fa7b09b45ed362fa287d","tarball":"https://registry.npmjs.org/@commerce-atoms/money/-/money-0.0.2.tgz","fileCount":19,"integrity":"sha512-gr1o5GxJAynZYmlEhwdPIrQWHrV6QPaqjXCbSA59fi0hybw+258SHixL8W8dHLUx+RzsSL8QiCh6YiMpaSC+tA==","signatures":[{"sig":"MEQCIFTOkmVR8WGhXthdSm0ER4CJq1vsoLlWKASPGeij1dk4AiB0kxVwfAbk7YSRmCLZ56E8WVXlRGtisfE93S4gDlf0sg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@commerce-atoms%2fmoney@0.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":18318},"type":"module","engines":{"node":">=18.0.0"},"exports":{"./types/money":{"types":"./dist/types/money.d.ts","import":"./dist/types/money.js"},"./package.json":"./package.json","./types/compare":{"types":"./dist/types/compare.d.ts","import":"./dist/types/compare.js"},"./types/options":{"types":"./dist/types/options.d.ts","import":"./dist/types/options.js"},"./parse/parseAmount":{"types":"./dist/parse/parseAmount.d.ts","import":"./dist/parse/parseAmount.js"},"./format/formatMoney":{"types":"./dist/format/formatMoney.d.ts","import":"./dist/format/formatMoney.js"},"./format/formatRange":{"types":"./dist/format/formatRange.d.ts","import":"./dist/format/formatRange.js"},"./compare/formatCompare":{"types":"./dist/compare/formatCompare.d.ts","import":"./dist/compare/formatCompare.js"},"./compare/calculateDiscountPercent":{"types":"./dist/compare/calculateDiscountPercent.d.ts","import":"./dist/compare/calculateDiscountPercent.js"}},"gitHead":"c8d7b03c7ec07aca93250f377e5da0bbc4090d29","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","pack:check":"npm pack --dry-run --silent","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fbf45f8f-8a03-4198-a98f-becf1326317f"}},"repository":{"url":"git+https://github.com/commerce-atoms/shoppy.git","type":"git","directory":"packages/money"},"_npmVersion":"11.7.0","description":"Pure money formatting and compare-at pricing","directories":{},"sideEffects":false,"_nodeVersion":"22.21.1","dependencies":{},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/money_0.0.2_1766434566194_0.17057296271052214","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@commerce-atoms/money","version":"0.0.3","description":"Pure money formatting and compare-at pricing","type":"module","sideEffects":false,"keywords":["shopify","hydrogen","money","price","formatting","ecommerce","utilities"],"author":{"name":"Commerce Atoms"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/commerce-atoms/shoppy.git","directory":"packages/money"},"homepage":"https://github.com/commerce-atoms/shoppy/tree/main/packages/money","bugs":{"url":"https://github.com/commerce-atoms/shoppy/issues"},"publishConfig":{"access":"public","provenance":true},"exports":{"./package.json":"./package.json","./format/formatMoney":{"types":"./dist/format/formatMoney.d.ts","import":"./dist/format/formatMoney.js"},"./format/formatRange":{"types":"./dist/format/formatRange.d.ts","import":"./dist/format/formatRange.js"},"./compare/formatCompare":{"types":"./dist/compare/formatCompare.d.ts","import":"./dist/compare/formatCompare.js"},"./compare/calculateDiscountPercent":{"types":"./dist/compare/calculateDiscountPercent.d.ts","import":"./dist/compare/calculateDiscountPercent.js"},"./parse/parseAmount":{"types":"./dist/parse/parseAmount.d.ts","import":"./dist/parse/parseAmount.js"},"./types/money":{"types":"./dist/types/money.d.ts","import":"./dist/types/money.js"},"./types/options":{"types":"./dist/types/options.d.ts","import":"./dist/types/options.js"},"./types/compare":{"types":"./dist/types/compare.d.ts","import":"./dist/types/compare.js"}},"dependencies":{},"engines":{"node":">=18.0.0"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","test":"vitest run","pack:check":"npm pack --dry-run --silent","prepublishOnly":"npm run build"},"gitHead":"cb71c4946a520552b92a61c1cf54fe03eefdd1c6","_id":"@commerce-atoms/money@0.0.3","_nodeVersion":"22.21.1","_npmVersion":"11.7.0","dist":{"integrity":"sha512-9FlpzdelqG5LjL6MOgf/0xP6UfOlH9Q2FeiqGViPgzQsKYSNNnf1bziFJcnPnEtLYVbc7Oobe6v31PaldFPGTA==","shasum":"29b9f88d5e67f7f15d9b898d94fe72fae699dda1","tarball":"https://registry.npmjs.org/@commerce-atoms/money/-/money-0.0.3.tgz","fileCount":19,"unpackedSize":18318,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@commerce-atoms%2fmoney@0.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCzA6pcqjXEPWCAzC0/xYB7zYskCDibNvDu/NoZ6MCjOgIgY/w9VA1jwvIFpwdwJO1efUBhmPz+7M+PL7rpl3Aa+p4="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fbf45f8f-8a03-4198-a98f-becf1326317f"}},"directories":{},"maintainers":[{"name":"doctor.undefined","email":"contact@soundefined.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/money_0.0.3_1766434700515_0.1045127767299956"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-22T19:25:21.679Z","modified":"2025-12-22T20:18:21.033Z","0.0.1":"2025-12-22T19:25:21.976Z","0.0.2":"2025-12-22T20:16:06.345Z","0.0.3":"2025-12-22T20:18:20.657Z"},"bugs":{"url":"https://github.com/commerce-atoms/shoppy/issues"},"author":{"name":"Commerce Atoms"},"license":"MIT","homepage":"https://github.com/commerce-atoms/shoppy/tree/main/packages/money","keywords":["shopify","hydrogen","money","price","formatting","ecommerce","utilities"],"repository":{"type":"git","url":"git+https://github.com/commerce-atoms/shoppy.git","directory":"packages/money"},"description":"Pure money formatting and compare-at pricing","maintainers":[{"name":"doctor.undefined","email":"contact@soundefined.com"}],"readme":"# @commerce-atoms/money\n\n**Pure money formatting and compare-at pricing.**\n\n## Purpose\n\nConsistent money formatting without repeated Intl boilerplate. Provides deterministic formatting and compare-at pricing display rules.\n\n## Non-goals\n\nThis package explicitly does **NOT**:\n\n- ❌ Convert currencies or handle FX\n- ❌ Fetch prices from Shopify\n- ❌ Provide UI components\n- ❌ Manage React state\n\n## API\n\n### formatMoney\n\n```typescript\nimport {formatMoney} from '@commerce-atoms/money/format/formatMoney';\n\nconst formatted = formatMoney({amount: '19.99', currencyCode: 'USD'});\n// Returns: \"$19.99\"\n\nconst formatted = formatMoney({amount: 'invalid', currencyCode: 'USD'});\n// Returns: \"—\" (em dash for invalid inputs)\n```\n\n### formatRange\n\n```typescript\nimport {formatRange} from '@commerce-atoms/money/format/formatRange';\n\nconst range = formatRange(\n  {amount: '10.00', currencyCode: 'USD'},\n  {amount: '20.00', currencyCode: 'USD'},\n);\n// Returns: \"$10.00–$20.00\" (en dash, not hyphen)\n\nconst single = formatRange(\n  {amount: '10.00', currencyCode: 'USD'},\n  {amount: '10.00', currencyCode: 'USD'},\n);\n// Returns: \"$10.00\" (single price when equal)\n```\n\n### formatCompare\n\n```typescript\nimport {formatCompare} from '@commerce-atoms/money/compare/formatCompare';\n\nconst result = formatCompare(\n  {amount: '19.99', currencyCode: 'USD'},\n  {amount: '29.99', currencyCode: 'USD'},\n);\n// Returns: {\n//   show: true,\n//   price: \"$19.99\",\n//   compareAt: \"$29.99\",\n//   discountPercent: 33\n// }\n```\n\n**Display rules:**\n\n- `show: false` when compare-at is missing, invalid, or <= price\n- `show: true` only when compare-at > price\n- Discount percent is rounded to nearest integer\n- discountPercent is display-only (not accounting-grade) and may differ by 1% due to rounding.\n\n## Fallback Behavior\n\nAll functions return `'—'` (em dash) for invalid inputs:\n\n- Null/undefined money objects\n- Invalid amount values (NaN)\n- Currency mismatches (for range/compare)\n\n**Note:** `formatRange` uses an en dash (`–`) between min and max prices, not a hyphen. This follows typographic conventions for ranges.\n\n## Type Philosophy\n\nUses **structural types** to accept any object matching the required shape.\n\n## Status\n\n- 0.x\n- ESM only, Node >=18\n\n## Compatibility\n\n- Works with Hydrogen, custom backends, anything\n- Uses Intl.NumberFormat (available in Node 18+ and browsers)\n\n## Delete-ability\n\nRemoving this package = replacing imports. That's it.\n","readmeFilename":"README.md"}