number-into-words
v1.0.2
Published
A npm package to convert number into words
Downloads
27
Maintainers
Readme
Number Into Words
number-into-words is a light-weight, quick number to words generator for NodeJS or other Front End Frameworks that uses JavaScript. It has ZERO dependency.
- Generate Words from Numbers (Capital/lowercase/UPPERCASE Supported)
- Two Major Numbering System Supported (Indian & International Number System)
- Auto Punctuation inbuilt.
- ZERO Dependencies.
- Light Weight (9 kB as measured correctly).
- Test Before Installing (Link is provided in Reference Section).
Installation
number-into-words requires Node.js v6+ or A browser Support upto ES6 alteast to run. Backward compatibility will be added in Upcoming Versions.
Create a directory and install the package.
$ mkdir number-into-words-folder
$ cd number-into-words-folder
$ npm install number-into-words
Reference:
| Repo | README | | ------ | ------ | | Github | https://github.com/amandeeptherockstar/number-into-words | | NPM Package | https://www.npmjs.com/package/number-into-words | | Test Online | https://numberintowords.netlify.com/ |
Load Module in Project
Load the Module:
const converter = require('number-into-words');
Methods
Module gives us two methods to use:
#1. indianConversion(number, {characterCase: value});
** number: int = Number which needs to be converted into Words Using Indian Numbering System. ** value: string = value can be the return case of words, Possible values are: capital, uppercase and lowercase. For more info On Indian Numbering System visit https://en.wikipedia.org/wiki/Indian_numbering_system
#2. internationalConversion(number, {characterCase: value});
** number: int = Number which needs to be converted into Words Using International Numbering System. ** value: string = value can be the return case of words, Possible values are: capital, uppercase and lowercase. For more info On International Numbering System visit https://www.math-only-math.com/international-numbering-system.html
Examples
/* indianConversion */
const words = converter.indianConversion(7664190, {characterCase: 'UPPERCASE'});
console.log(words);
// output - SEVENTY-SIX LAC, SIXTY-FOUR THOUSAND, ONE HUNDRED AND NINETY.
/* internationalConversion */
const words = converter.internationalConversion(100000001, {characterCase: 'lowercase'});
console.log(words);
// output - one hundred million and three.
Testing Online Before Installing
Visit the following URL to see the practical use of this package: https://numberintowords.netlify.com/
License
MIT
Free Package, Hell Yeah!