0.11.0 • Published 6 years ago
english-words-to-numbers v0.11.0
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]