Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

words-to-numbers

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

words-to-numbers - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "words-to-numbers",
"description": "convert textual words to numbers with optional fuzzy text matching",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "options": {

@@ -17,17 +17,24 @@ # Words To Numbers

import wordsToNumbers from 'words-to-numbers';
wordsToNumbers('one hundred'); //100;
wordsToNumbers('one hundred and five'); //105;
wordsToNumbers('one hundred and twenty five'); //125;
wordsToNumbers('four thousand and thirty'); //4030;
wordsToNumbers('six million five thousand and two'); //6005002;
wordsToNumbers('a thousand one hundred and eleven'); //1111;
wordsToNumbers('twenty thousand five hundred and sixty nine'); //20569;
wordsToNumbers('five quintillion'); //5000000000000000000;
wordsToNumbers('one-hundred'); //100;
wordsToNumbers('one-hundred and five'); //105;
wordsToNumbers('one-hundred and twenty-five'); //125;
wordsToNumbers('four-thousand and thirty'); //4030;
wordsToNumbers('six-million five-thousand and two'); //6005002;
wordsToNumbers('a thousand, one-hundred and eleven'); //1111;
wordsToNumbers('twenty-thousand, five-hundred and sixty-nine'); //20569;
wordsToNumbers('one hundred'); //100
wordsToNumbers('one hundred and five'); //105
wordsToNumbers('one hundred and twenty five'); //125
wordsToNumbers('four thousand and thirty'); //4030
wordsToNumbers('six million five thousand and two'); //6005002
wordsToNumbers('a thousand one hundred and eleven'); //1111
wordsToNumbers('twenty thousand five hundred and sixty nine'); //20569
wordsToNumbers('five quintillion'); //5000000000000000000
wordsToNumbers('one-hundred'); //100
wordsToNumbers('one-hundred and five'); //105
wordsToNumbers('one-hundred and twenty-five'); //125
wordsToNumbers('four-thousand and thirty'); //4030
wordsToNumbers('six-million five-thousand and two'); //6005002
wordsToNumbers('a thousand, one-hundred and eleven'); //1111
wordsToNumbers('twenty-thousand, five-hundred and sixty-nine'); //20569
```
## Multiple numbers in a string
Returns a string with all instances replaced.
```javascript
wordsToNumbers('there were twenty-thousand, five-hundred and sixty-nine X in the five quintillion Y')) // 'there were 20569 X in the 5000000000000000000 Y'

@@ -38,2 +45,4 @@ ```

Uses [Jaro distance](http://yomguithereal.github.io/clj-fuzzy/javascript.html#jaro) to find the best match for the number words. Don't rely on this being completely accurate...
```javascript

@@ -40,0 +49,0 @@ import wordsToNumbers from 'words-to-numbers';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc