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

Category: Javascript | December 28, 2023
Author:f3rno64
Views Total:36 views
Official Page:Go to website
Last Update:December 28, 2023
License:MIT

Preview:

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

Description:

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