Author: | humanwhocodes |
---|---|
Views Total: | 212 views |
Official Page: | Go to website |
Last Update: | October 22, 2021 |
License: | MIT |
Preview:

Description:
A JavaScript library that converts arbitrary positive integers into English words.
See Also:
- JavaScript Library To Convert Numbers To Words – numberToWordsJS
- Convert Number/Money To Words – numbersinwords
- Multilingual Number To Word Converter – jQuery SpellingNumber
How to use it:
1. Install and import the Number to Words library.
# Yarn $ yarn add @humanwhocodes/number-to-words # NPM $ npm i @humanwhocodes/number-to-words
// node const { numberToWords } = require("@humanwhocodes/number-to-words"); import { numberToWords } from "@humanwhocodes/number-to-words";
// browser <script type="module"> import { numberToWords } from "https://cdn.skypack.dev/@humanwhocodes/number-to-words?min"; </script>
2. Convert a number (must be positive interger) into English words.
numberToWords(12345) // => twelve thousand three hundred forty-five