format-si-prefix editorconfig eslint travis-ci npm

Format and unformat numbers with SI prefixes

3 years after

format-si-prefix

npm David David

Format and unformat numbers with SI prefixes.

API

formatSI()

import {formatSI} from 'format-si-prefix';
const string = formatSI(number);
in out
... ...
0.000111111 111µ
0.00111 1.11m
0.0111 11.1m
0.111 111m
1 1
11 11
111 111
1111 1.11k
11111 11.1k
111111 111k
1111111 1.11M
... ...

unformatSI()

import {unformatSI} from 'format-si-prefix';
const number = unformatSI(string);
in out
... ...
111µ 0.000111
1.11m 0.00111
11.1m 0.0111
111m 0.111
1 1
11 11
111 111
1.11k 1110
11.1k 11100
111k 111000
1.11M 1110000
... ...
12.345M 12345000
12.345 12.345
1234567 1234567
123456M 123456000000
1000.1m 1.0001
... ...

License

MIT

Related Repositories

d3-scale

d3-scale

Encodings that map abstract data to visual representation. ...

czmq

czmq

High-level C binding for ØMQ ...

humanize

humanize

Java facility for adding a “human touch” to data. ...

php-iban

php-iban

Generate, parse, validate, error-correct and present IBAN (and IIBAN) bank accou ...

d3-format

d3-format

Format numbers for human consumption. ...


Top Contributors

ThomWright

Releases

-   v0.3.1 zip tar
-   v0.3.0 zip tar
-   v0.2.1 zip tar
-   v0.2.0 zip tar
-   v0.1.5 zip tar
-   v0.1.4 zip tar
-   v0.1.3 zip tar
-   v0.1.2 zip tar
-   v0.1.1 zip tar
-   v0.1.0 zip tar