JSPM

english-words-to-numbers

0.11.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q30801F
  • License Unlicense

Convert all words in a string into numbers. Unlike other packages, it can optionally return the entire revised string with Arabic numbers instead of words.

Package Exports

  • english-words-to-numbers

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (english-words-to-numbers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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]