@pogix3m/short-number

1.0.1 • Public • Published

short-number Build Status GitHub license GitHub package.json version

Convert long number to short number for readability. By default up to Unvigintillion(10^66)

Installation

$ npm install --save @pogix3m/short-number

Usage

var shortNumber = require('@pogix3m/short-number');

shortNumber(1000);
// => 1K

shortNumber(756_159_852);
// => 756.15M

shortNumber(-6248645.13);
// => -6.24M

shortNumber("6248645.13");
// => 6.24M

// provide the suffix
const suffix = [
    "Thousand",
    "Million",
    "Billion",
    "Trillion",
    "Quadrillion"
];

shortNumber(28728, suffix);
// => 28.72Thousand

shortNumber(756159852, suffix);
// => 756.15Million

Package Sidebar

Install

npm i @pogix3m/short-number

Weekly Downloads

20

Version

1.0.1

License

MIT

Unpacked Size

9.2 kB

Total Files

6

Last publish

Collaborators

  • pogix3m