abbr-number-to-string
v1.0.2
Published
A package to turn numbers into shortened strings based on the amount of decimal points available. 1200 to 1.2k
Downloads
3
Maintainers
Readme
Abbr-number-to-string
A simple package to convert number data types into an abbreviated string. It takes in two arguments: the number to convert and the amount of decimal places you would like to round up to.
abbrNum(3567, 2) will become 3.57K
abbrNum(2942345,1) will become 2.9M
abbrNum(9876234987,3) will become 9.876B
Installation:
npm i abbr-number-to-string --save
Usage:
const abbrNum = require('abbr-number-to-string')
abbrNum(number,decimalpoints)
Uses Mocha and Travis for testing.