1.0.1 • Published 5 years ago

number-shortener v1.0.1

Weekly downloads
43
License
ISC
Repository
github
Last release
5 years ago

number-shortener

Takes a long number and translates to a beautifully short number.

1000 = 1k

2600000 = 2.6m

301000000001 = 301b+

99999999999999 = 99.9t+

x > 9999999999999999 = scientific notation

Installing

Using NPM

npm i number-shortener

Example

Import

const shortNum = require('number-shortener')
shortNum(301000000001) //returns 301b+
shortNum(9999999999999999999991) //returns 1e+22