Spells number in English language
npm install number-spellerspellNumber(1000) > _one thousand_spellNumber(7598025) > _seven million five hundred ninety eight thousand twenty five_spellNumber(900000000) > _nine hundred million_Can be used in a browser as well and nodeJs applications.
Witten in TypeScript and covered with unit tests.
Install with npm install number-speller and import with
``ts`
import { spellNumber } from 'number-speller';`
orjs`
const { spellNumber } = require('number-speller');
for commonJs environment.
function accepts a single argument - number to be spelled and returns a string.
- maxSupportedNumber constant with the maximum number currently supported by the module.Limitations
- Works with integers. Number with fractional part gets rounded.
- Supports positive numbers only.
- Doesn't support numbers passed in string form.
I.e. spellNumber('1000') throws an exception.
- Maximum number currently supported is one thousand billion minus one -
999 999 999 999.
- Does not use hyphens for numbers between 21 and 99`: _twenty one_ instead of _twenty-one_.