english-words-to-numbers

0.11.0 • Public • Published

English Words to Numbers Converter

This package converts numbers expressed in English words (which can be mixed with Arabic numerals) into Arabic-only numbers.

Convert entire string

const wtn = require('english-words-to-numbers');
 
wtn('It was somewhere about 3 million, maybe 4 million at most.'); // 'It was somewhere about 3000000, maybe 4000000 at most.'
wtn('six point six million dollars and five cents'); // '6600000 dollars and 5 cents'
wtn('the repairs came up at fourty five hundred point five dollars'); // 'the repairs came up at 4500.5 dollars'
wtn('the total is 2.7 grand', { enableExtras: true }); // 'the total is 2700'
 

Return an array of converted numbers only

This feature is in development and not available yet.

const { numbers } = require('english-words-to-numbers');
numbers('this will require sixty to ninety days'); // [60, 90]
 

Dependencies (4)

Dev Dependencies (2)

Package Sidebar

Install

npm i english-words-to-numbers

Weekly Downloads

0

Version

0.11.0

License

Unlicense

Unpacked Size

20.7 kB

Total Files

5

Last publish

Collaborators

  • anton-ivanov