Turn a long number into a short one to improve readability. Supports numbers up to 1e+308
Installation
$ yarn add anumber
Or
$ npm install anumber
Usage
const anumber = require('anumber')
anumber.encode(1200) // -> 1.2K
anumber.encode(-1200) // -> -1.2K
anumber.encode(994500000000000000000000000) // -> 994.5Y
anumber.decode('3.2M') // -> 3200000
anumber.decode('-24K') // -> -24000
Change exponents value
const anumber = require('anumber')
anumber.exponents = ['', 'A', 'B', 'C', 'D']
anumber.encode(240) // -> 240
anumber.encode(240000) // -> 240.0C