{"_id":"toformat","_rev":"5-ad2d500505cb8e2b48ca48b55425c056","name":"toformat","description":"Adds a `toFormat` instance method to decimal.js or big.js","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"toformat","version":"1.0.0","description":"Adds a `toFormat` instance method to decimal.js or big.js","main":"toFormat.js","devDependencies":{"big.js":"*","decimal.js":">=5.0.0"},"scripts":{"test":"node test","build":"uglifyjs toFormat.js -c -m -o toFormat.min.js"},"repository":{"type":"git","url":"git+https://github.com/MikeMcl/toFormat.git"},"keywords":["format","bignumber","big","number","big.js","decimal.js"],"author":{"name":"Michael Mclaughlin"},"license":"MIT","bugs":{"url":"https://github.com/MikeMcl/toFormat/issues"},"homepage":"https://github.com/MikeMcl/toFormat#readme","gitHead":"4f07c3b7a16bd3f9d56d00f0c2537c5225791a88","_id":"toformat@1.0.0","_shasum":"1cbefa021ccd3eb4483d496bcf1ee7e11a35d585","_from":".","_npmVersion":"3.7.1","_nodeVersion":"5.1.1","_npmUser":{"name":"mikemcl","email":"M8ch88l@gmail.com"},"dist":{"shasum":"1cbefa021ccd3eb4483d496bcf1ee7e11a35d585","tarball":"https://registry.npmjs.org/toformat/-/toformat-1.0.0.tgz","integrity":"sha512-jry3k0Wr1Nguh4BuQfbUP1xidmvVxBvlrft67V2ESYVFixvryF8DW7IOIpaaIDwQwSW0F3iYZBThGqk1dveGVA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBu5Ppl83jbzhOcOuyD4V8o086aFWUJdVvklm4vLJK1wIgPoqJUJNq5cbOgebmmtdT/AxhVDSSFZw/5r1H8mBT2rg="}]},"maintainers":[{"name":"mikemcl","email":"M8ch88l@gmail.com"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/toformat-1.0.0.tgz_1455136253053_0.06735359062440693"}},"2.0.0":{"name":"toformat","version":"2.0.0","description":"Adds a `toFormat` instance method to decimal.js or big.js","main":"toFormat.js","devDependencies":{"big.js":"*","decimal.js":">=5.0.0"},"scripts":{"test":"node test","build":"uglifyjs toFormat.js -c -m -o toFormat.min.js --preamble \"/* toFormat.js v2.0.0 https://github.com/MikeMcl/toFormat */\""},"repository":{"type":"git","url":"git+https://github.com/MikeMcl/toFormat.git"},"keywords":["format","bignumber","big","number","big.js","decimal.js"],"author":{"name":"Michael Mclaughlin"},"license":"MIT","bugs":{"url":"https://github.com/MikeMcl/toFormat/issues"},"homepage":"https://github.com/MikeMcl/toFormat#readme","files":["toFormat.js","toFormat.min.js"],"gitHead":"a45a742f7820b10f1a4e4cd33b9ad68ba28f9dd4","_id":"toformat@2.0.0","_npmVersion":"5.0.4","_nodeVersion":"8.7.0","_npmUser":{"name":"mikemcl","email":"M8ch88l@gmail.com"},"dist":{"integrity":"sha512-03SWBVop6nU8bpyZCx7SodpYznbZF5R4ljwNLBcTQzKOD9xuihRo/psX58llS1BMFhhAI08H3luot5GoXJz2pQ==","shasum":"7a043fd2dfbe9021a4e36e508835ba32056739d8","tarball":"https://registry.npmjs.org/toformat/-/toformat-2.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA8UDq2zzN6wcDIhBLbaBva4YgjlMw8z6FbumzEgVDkyAiBH/qpzGxD3oyggEElNtW3ecwecnBeTXWEjH1gK5y0csw=="}]},"maintainers":[{"name":"mikemcl","email":"M8ch88l@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/toformat-2.0.0.tgz_1508190309713_0.34964007162488997"}}},"readme":"# toFormat\r\n\r\nAdds a `toFormat` instance method to [big.js](https://github.com/MikeMcl/big.js/) or [decimal.js](https://github.com/MikeMcl/decimal.js/).\r\n\r\n## Install\r\n\r\nNode.js\r\n\r\n```bash\r\n$ npm install toformat\r\n```\r\n\r\nBrowser\r\n\r\n```html\r\n<script src='path/to/big.js'></script>\r\n<script src='path/to/toFormat.js'></script>\r\n```\r\n\r\n## Use\r\n\r\n### Node.js\r\n\r\n```js\r\nBig = require('big')\r\nBig = require('toformat')(Big)\r\n\r\nx = new Big(9876.54321)\r\nx.toFormat(2)                       // '9,876.54'\r\n\r\n// Three different ways of setting a formatting property\r\nBig.format.decimalSeparator = ','\r\nx.format.groupSeparator: ' '\r\nx.toFormat(1, { groupSize: 2 })    // '98 76,5'\r\n```\r\n\r\n### Browser\r\n\r\n```js\r\ntoFormat(Big)\r\nx = new Big(9876.54321)\r\nx.toFormat(2)                      // '9,876.54'\r\n```\r\n\r\n### Further examples:\r\n\r\n```js\r\n// The format object added to the Decimal constructor by this library.\r\nDecimal.format = {\r\n  decimalSeparator: '.',\r\n  groupSeparator: ',',\r\n  groupSize: 3,\r\n  secondaryGroupSize: 0,\r\n  fractionGroupSeparator: '',\r\n  fractionGroupSize : 0\r\n}\r\n\r\nx.toFormat()                        // 123,456,789.987654321\r\nx.toFormat(2, 1)                    // 123,456,789.98\r\n\r\n// Add a format object to a Decimal instance.\r\nx.format = {\r\n  decimalSeparator: ',',\r\n  groupSeparator: '',\r\n}\r\n\r\nx.toFormat()                       // 123456789,987654321\r\n\r\nformat = {\r\n  decimalSeparator: '.',\r\n  groupSeparator: ' ',\r\n  groupSize: 3,\r\n  fractionGroupSeparator: ' ',\r\n  fractionGroupSize : 5\r\n}\r\n\r\n// Pass a format object to the method call.\r\nx.toFormat(format)                 // 123 456 789.98765 4321\r\nx.toFormat(4, format)              // 123 456 789.9877\r\nx.toFormat(2, 1, format)           // 123 456 789.98\r\n```\r\n\r\n## Test\r\n\r\n```bash\r\n$ npm test\r\n```\r\n\r\n## Licence\r\n\r\n[MIT](LICENCE)\r\n","maintainers":[{"name":"mikemcl","email":"M8ch88l@gmail.com"}],"time":{"modified":"2022-06-27T07:30:39.792Z","created":"2016-02-10T20:30:56.416Z","1.0.0":"2016-02-10T20:30:56.416Z","2.0.0":"2017-10-16T21:45:10.614Z"},"homepage":"https://github.com/MikeMcl/toFormat#readme","keywords":["format","bignumber","big","number","big.js","decimal.js"],"repository":{"type":"git","url":"git+https://github.com/MikeMcl/toFormat.git"},"author":{"name":"Michael Mclaughlin"},"bugs":{"url":"https://github.com/MikeMcl/toFormat/issues"},"license":"MIT","readmeFilename":"README.md"}