{"name":"@formatjs/intl-unified-numberformat","version":"2.1.4-alpha.6","description":"Ponyfill for intl unified numberformat proposal","keywords":["polyfill","i18n","numberformat","unified"],"author":{"name":"Long Ho","email":"holevietlong@gmail.com"},"homepage":"https://github.com/formatjs/formatjs","license":"MIT","main":"dist/index.js","module":"lib/index.js","types":"lib/intl-unified-numberformat.d.ts","repository":{"type":"git","url":"git+https://github.com/formatjs/formatjs.git"},"devDependencies":{"@formatjs/intl-pluralrules":"^1.3.4-alpha.6+deb124d","formatjs-extract-cldr-data":"^9.9.4-alpha.6+deb124d"},"dependencies":{"@formatjs/intl-utils":"^1.4.1"},"scripts":{"build":"npm run cldr && npm run compile","cldr":"ts-node --project tsconfig.cjs.json scripts/cldr","clean":"rimraf dist lib","compile":"tsc && tsc -p tsconfig.cjs.json && api-extractor run --local && rollup -c rollup.config.js","jest":"cross-env NODE_ICU_DATA=../../node_modules/full-icu TS_NODE_PROJECT=tsconfig.cjs.json cross-env NODE_ENV=test jest","test":"npm run jest"},"bugs":{"url":"https://github.com/formatjs/formatjs/issues"},"gitHead":"deb124d6bd86cf515b2be60fc9b4d4f0e9b9d907","readme":"# `intl-unified-numberformat`\n\nA ponyfill/polyfill for [`intl-unified-numberformat`](https://github.com/tc39/proposal-unified-intl-numberformat). This wraps `Intl.NumberFormat` and has the exact same APIs.\n\n## Installation\n\n```\nnpm install @formatjs/intl-unified-numberformat\n```\n\n## Requirements\n\nThis package requires the following capabilities:\n\n- [Intl.PluralRules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules)\n\n# Features\n\n1. `unit`, `unitDisplay`, `style: unit` and sanctioned units are supported\n\n## Caveats\n\n1. `formatToParts` does not include the `unit` part yet.\n\n# Usage\n\nTo use the ponyfill, import it along with its data:\n\n```tsx\nimport {UnifiedNumberFormat} from '@formatjs/intl-unified-numberformat';\nUnifiedNumberFormat.__addLocaleData(\n  require('@formatjs/intl-unified-numberformat/dist/locale-data/zh.json') // locale-data for zh\n);\nUnifiedNumberFormat.__addLocaleData(\n  require('@formatjs/intl-unified-numberformat/dist/locale-data/en.json') // locale-data for en\n);\n\nnew UnifiedNumberFormat('zh', {\n  style: 'unit',\n  unit: 'bit',\n  unitDisplay: 'long',\n}).format(1000); // 1,000比特\n```\n\nTo use this as a polyfill, override `Intl.NumberFormat` as below:\n\n```tsx\nimport '@formatjs/intl-unified-numberformat/polyfill';\nif (typeof Intl.NumberFormat.__addUnitLocaleData === 'function') {\n  Intl.NumberFormat.__addUnitLocaleData(\n    require('@formatjs/intl-unified-numberformat/dist/locale-data/zh.json') // locale-data for zh\n  );\n  Intl.NumberFormat.__addUnitLocaleData(\n    require('@formatjs/intl-unified-numberformat/dist/locale-data/en.json') // locale-data for en\n  );\n}\n\nnew Intl.NumberFormat('zh', {\n  style: 'unit',\n  unit: 'bit',\n  unitDisplay: 'long',\n}).format(1000); // 1,000比特\n```\n\n## Supported Units\n\nCurrently [intl-unified-numberformat](https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_diff_out.html#sec-issanctionedsimpleunitidentifier) has a list of sanctioned units as below\n\n```tsx\ntype Unit =\n  | 'acre'\n  | 'bit'\n  | 'byte'\n  | 'celsius'\n  | 'centimeter'\n  | 'day'\n  | 'degree'\n  | 'fahrenheit'\n  | 'fluid-ounce'\n  | 'foot'\n  | 'gallon'\n  | 'gigabit'\n  | 'gigabyte'\n  | 'gram'\n  | 'hectare'\n  | 'hour'\n  | 'inch'\n  | 'kilobit'\n  | 'kilobyte'\n  | 'kilogram'\n  | 'kilometer'\n  | 'liter'\n  | 'megabit'\n  | 'megabyte'\n  | 'meter'\n  | 'mile'\n  | 'mile-scandinavian'\n  | 'millimeter'\n  | 'milliliter'\n  | 'millisecond'\n  | 'minute'\n  | 'month'\n  | 'ounce'\n  | 'percent'\n  | 'petabyte'\n  | 'pound'\n  | 'second'\n  | 'stone'\n  | 'terabit'\n  | 'terabyte'\n  | 'week'\n  | 'yard'\n  | 'year';\n```\n","readmeFilename":"README.md","_id":"@formatjs/intl-unified-numberformat@2.1.4-alpha.6","_nodeVersion":"10.16.0","_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","dist":{"integrity":"sha512-1Ryh07AyZqyo6PVuSsg3eiQ0X3Acc12pWNLW2+3rkWQvtu6PYfVJBq73dPjXN0Z4gNlT+yesOd1QrWiRm4FO9g==","shasum":"9e4d4d2bf7369f95ffeb07347bd77f970cc12d24","tarball":"http://registry-npm.ywwl.com/@formatjs/intl-unified-numberformat/download/@formatjs/intl-unified-numberformat-2.1.4-alpha.6.tgz","fileCount":451,"unpackedSize":15924397,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1hh1CRA9TVsSAnZWagAAqQUP/iA0UvUcI43/qx0KSyM7\nFAh4erJ/8HZMkyIucN/PaD6ySV32rX4v6hHXIGVRUQBNUXJmNxXsO1HFD4GB\nMnHTrjPChNeb8GfsgLTVszxZTED6RJPEMjbg+ZAldTaBtMut/8d9VQ9DtrGq\nbw5VA2ZPWLcVLeGa745awKBtikhsrl/g1EeuOnSWlk2s5o64JMqdZRdeLp8x\nA4S9X6kzEWADtLVKLpBmvLhs3AjhKcO9QP+DaPEi8MoL8+Np9Y9bjbHLTlXS\ntIUokpYQE/gwrTVneOaG5qCHGttmghbWM6MCTr8P3Tcpu0dPOmM9w8oDs1+f\nlw67QFzdFvSOfMes3D4S76hoIiZNyTbNCqZlBS+sxYBY6KLZh6mZwJnWKREp\n1RwSsaABcm3q1hEOtxN1x68zfesfwCPW0cd1kVbrLuLVBTS5A5FzSiiIrGnA\nGlcsN0BeTCN6lNPu+kDDE/2catIjEmRezxJNbtMWnhiRzcI8T+ypN+mv8Vlr\nSKrAi+W1lgeO6+g/MtRiQv1/lFkIZdTRsttmU1OhFzQHU9z8MfPf3hlwrekC\nEoihZT+rH9/sdSPhktakS0Mmf9Pz0wQfQwYae2ARK9MFhp0z1ntYrx13vrjt\nkfMwZPYzjVC0FI24pqxUSzjvqdX4LmMgs5Rd8aNkwl+cMPIhrrErC/s/pD9r\nxuFu\r\n=LM8N\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFGb/HKUqDGChkxctYFTMqFzAPPafPH/DN6GDq3cENLPAiEA8pWe+ZTcJrfMXyyHLaFX6pp4o/8cZzcHt0mxOw3J9Nw="}],"size":1150184,"noattachment":false,"key":"/@formatjs/intl-unified-numberformat/-/@formatjs/intl-unified-numberformat-2.1.4-alpha.6.tgz"},"maintainers":[{"name":"longlho","email":"holevietlong@gmail.com"},{"name":"redonkulus","email":"seth@bertalotto.net"}],"_npmUser":{"name":"longlho","email":"holevietlong@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/intl-unified-numberformat_2.1.4-alpha.6_1574312053279_0.4380375811866102"},"_hasShrinkwrap":false,"publish_time":1574312053495,"_cnpm_publish_time":1574312053495,"dist-tags":{"latest":"3.3.7","next":"2.1.4-alpha.7"}}