1.0.0 • Published 6 years ago

reformat-number v1.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
6 years ago

Reformat-Number · GitHub license

re-format javascript string-numbers with ease

GitHub license npm Codacy Badge Codacy Badge

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

yarn add reformat-number

Usage

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'