react-number-to-words
v1.0.5
Published
Converts number to words.
Downloads
221
Maintainers
Readme
React Number to Words
This is a React-based npm package that translates/converts numbers into words. It allows developers to easily integrate this functionality into their React applications. This package will help to convert number or amounts into words form.
Installation
npm install react-number-to-words
Usage
- Import the convertToWords function from the package:
import {convertToWords} from 'react-number-to-words';
- Call the convertToWords function with a number as an argument:
const number = 123;
const words = convertToWords(number);
console.log(words); // Output: "One Hundred and Tweenty Three"
- (Optional) Use the provided React components for user input and display:
import {NumberInput, NumberDisplay} from 'react-number-to-words';
- Call the toOrdinal function with a number as an argument:
const number = 123;
const ordinal = toOrdinal(number);
console.log(ordinal); // Output: "123th"
Features
- Converts numbers up to trillions into words.
- Supports custom number formatting (currently not implemented, but can be added in the future).
Contributing
Feel free to submit pull requests for bug fixes, improvements, or new features. We welcome community contributions.
License
This package is licensed under the MIT License.