Transform Words into Numbers with JavaScript – numbers-from-words

Category: Javascript | December 28, 2023
Authorf3rno64
Last UpdateDecember 28, 2023
LicenseMIT
Views81 views
Transform Words into Numbers with JavaScript – numbers-from-words

numbers-from-words is a zero-dependency JavaScript library that converts number words like “one hundred twenty three” into numeric values “123”.

If your application accepts number inputs as words, this utility library can parse them into numbers for calculations and processing.

See Also:

How to use it:

1. Install the numbers-from-words package with NPM  and import the parse component as follows:

# NPM
$ npm install numbers-from-words
import { parse } from 'numbers-from-words'

2. Call the parse function with a string containing number words as the argument to get the numeric value. For example:

// 123
const numberCon = parse('one hundred and twenty three');

You Might Be Interested In:


Leave a Reply