https://github.com/carloluis/reformat-number
reformat javascript string-numbers with ease :1234:
https://github.com/carloluis/reformat-number
comma digit-grouping es6 formatter javascript nodejs number reformat reformat-number
Last synced: 5 months ago
JSON representation
reformat javascript string-numbers with ease :1234:
- Host: GitHub
- URL: https://github.com/carloluis/reformat-number
- Owner: carloluis
- License: mit
- Created: 2018-02-17T23:37:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T02:51:19.000Z (over 8 years ago)
- Last Synced: 2025-10-26T14:57:42.932Z (8 months ago)
- Topics: comma, digit-grouping, es6, formatter, javascript, nodejs, number, reformat, reformat-number
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reformat-Number · [](https://github.com/carloluis/reformat-number)
> re-format javascript string-numbers with ease
[](https://github.com/carloluis/reformat-number/blob/master/LICENSE)
[](https://www.npmjs.com/package/reformat-number)
[](https://www.codacy.com/app/carloluis/reformat-number?utm_source=github.com&utm_medium=referral&utm_content=carloluis/reformat-number&utm_campaign=Badge_Grade)
[](https://www.codacy.com/app/carloluis/reformat-number?utm_source=github.com&utm_medium=referral&utm_content=carloluis/reformat-number&utm_campaign=Badge_Coverage)
This is a simple but opinionated number re-formatter.
* Input: a valid number which might contain commas and a dot for decimal separation.
* Output: same number with commas on right places (between each three digits group).
## Instalation
```bash
yarn add reformat-number
```
## Usage
```js
const reformat = require('reformat-number');
reformat('1234567890'); // => '1,234,567,890'
reformat('123,456,7890'); // => '1,234,567,890'
reformat('-12345678.90'); // => '-12,345,678.90'
reformat('1,2,3,4,5,6'); // => '123,456'
```
## License
MIT © [Carloluis](https://github.com/carloluis)