@kushalst/numbers-to-words-converter
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

@kushalst/numbers-to-words-converter

npm version

numbers-to-words-converter lets you expand numbers to words. There are other auxiallry functions that might help you achieve other things while you are at it.

Documentation

npm i @kushalst/numbers-to-words-converter

Number systems supported IN - Indian Number System (Lakhs, Crores, ...) INTL - International Number System (Millions, Billions, ...)

Functions Description
isSafeNumber(param1) Takes in a number and returns boolean. True if number is between MAX_SAFE_INTEGER and MIN_SAFE_INTEGER integer value supported by Js
toWords(param1, param2) param1 - Number to be expanded to string
param2 - IN for Indian number system. INTL for International number system
delCommas(param1) param1 - Takes in string with commas. Function deletes commas in the string and returns it

Examples

var { converter, SYSTEM } = require("@kushalst/numbers-to-words-converter");

converter.isSafeNumber(123123123123123123123445555);
//false

converter.isSafeNumber(1233445555);
//true

converter.toWords("10,00,000,32,78,944", SYSTEM.IN);
//ten lakh crore, thirty-two lakh, seventy-eight thousand, nine hundred forty-four

converter.toWords("103,278,944", SYSTEM.INTL);
//one hundred three million, two hundred seventy-eight thousand, nine hundred forty-four

converter.toWords("10,00,000,32,78,944", SYSTEM.INTL);
//ten trillion, three million, two hundred seventy-eight thousand, nine hundred forty-four

converter.toWords("10,,,46,3,278,944", SYSTEM.IN); // commas don't matter
//one thousand, forty-six crore, thirty-two lakh, seventy-eight thousand, nine hundred forty-four

converter.delCommas(converter.toWords("10,,,46,3,278,944", SYSTEM.INTL));
//ten billion four hundred sixty-three million two hundred seventy-eight thousand nine hundred forty-four

More features coming up soon!

Contributors

Kushal Shreyas

Package Sidebar

Install

npm i @kushalst/numbers-to-words-converter

Weekly Downloads

47

Version

1.1.1

License

MIT

Unpacked Size

42.7 kB

Total Files

28

Last publish

Collaborators

  • kushalst