anumber

1.0.0 • Public • Published

Turn a long number into a short one to improve readability. Supports numbers up to 1e+308

NPM Version NPM Install Size NPM Downloads

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

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i anumber

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

2.61 kB

Total Files

4

Last publish

Collaborators

  • shovity