UNPKG

word-number-converter

Version:

A simple JavaScript library to convert numbers to words and words to numbers. Works in both Node.js and browser environments.

29 lines (19 loc) 713 B
# word-number-converter A simple JavaScript library to convert numbers to words and words to numbers. Works in both Node.js and browser environments. --- ## ✨ Features - Convert words to numbers: `'three thousand twenty' 3020` - Convert numbers to words: `999 'nine hundred ninety-nine'` - Supports thousands and millions - Handles `"and"` or hyphenated numbers like `"twenty-one"` --- ## 🚀 Installation ```bash npm install word-number-converter ``` ## Example-Usage import {toNumber, toWords} from "word-number-converter; console.log(toNumber("One thousand one hundred")); Result: 1100 console.log(toWords(1998)); Result: one thousand nine hundred ninety-eight