thousands
A micro javascript library for formatting numbers with thousands separator.
Number.toLocaleString()?
Why should I use this overNumber.toLocaleString()
isn't supported in some browsers (< Safari 9, < IE 11), or if you're running in an older node environment (< 0.12) i18n support is not included. In most cases you will likely want to use Number.toLocaleString()
, but this library allows you to format numbers no matter what your environment supports.
Install
$ npm install --save thousands
Usage
const thousands = ; ; // => 1,234; // => 123,456; // => 1,234.56 ; // => 1 234; // => 123 456; // => 1 234.56
License
MIT © Jason Wilson