millifytolongify
v1.0.13
Published
" # millify & longify numbers"
Downloads
21
Maintainers
Readme
millifytolongify
Converts long numbers
into strings
and vice versa.
Demo
Use convertToMillify method
Before | After
--- | ---
2000
| '2K'
2000000
| '2M'
2000000000
| '2B'
2000000000000
| '2T'
2000000000000000
| '2Q'
Use convertToLongForm method
Before | After
--- | ---
'2K'
| 2,000.00
'2M'
| 2,000,000.00
'2B'
| 2,000,000,000.00
'2T'
| 2,000,000,000,000.00
'2Q'
| 2,000,000,000,000,000.00
Install
Get it on npm:
npm install millifytolongify
Usage
Import package where numbers needs to be converted:
import { millifytolongify } from 'millifytolongify'
#### To conver numbers with short form to comma separated value in long form
//By default converted value is in decimal format.
millifytolongify.convertToLongForm('2k');
//'2,000.00'
// If we dont want value in decimal format,then pass flag as false in convertToLongForm method
millifytolongify.convertToLongForm('2k',false);
//'2,000'
#### To millify numbers
millifytolongify.convertToMillify(2000.00);
//'2K'