react-number-to-words
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

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

  1. Import the convertToWords function from the package:
import {convertToWords} from 'react-number-to-words';
  1. 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"
  1. (Optional) Use the provided React components for user input and display:
import {NumberInput, NumberDisplay} from 'react-number-to-words';
  1. 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.

Package Sidebar

Install

npm i react-number-to-words

Weekly Downloads

36

Version

1.0.5

License

MIT

Unpacked Size

15.6 kB

Total Files

24

Last publish

Collaborators

  • nayanchdatta