millifytolongify
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

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'

Author

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i millifytolongify

    Weekly Downloads

    2

    Version

    1.0.13

    License

    ISC

    Unpacked Size

    7.29 kB

    Total Files

    10

    Last publish

    Collaborators

    • pritam01