Skip to content

ImBIOS/i18n-num-in-words

Repository files navigation

i18n-num-in-words

Convert Numbers to Words in Multiple Languages

A small, zero-dependency JavaScript library for converting numbers to words in multiple languages. Optimized for both Node.js and browser environments. Star us on GitHub for more updates:

NPM NPM Downloads GitHub stars

Features

  • Internationalized: 95% of the world speaks languages other than English. We got you covered.
  • Fully type safe: Leverage TypeScript's type inference and static type safety.
  • Small bundle size: Zero dependencies make i18n-num-in-words lightweight.
  • Test Coverage: Nearly 100% test coverage guarantees reliability.
  • Tree-shaking: Import only the languages you use to optimize your bundle size.

Installation

To start, choose the package manager you are most comfortable with:

npm

npm install i18n-num-in-words

yarn

yarn add i18n-num-in-words

pnpm

pnpm add i18n-num-in-words

bun

bun add i18n-num-in-words

Usage Example

To convert numbers to words, first import the relevant function from the package.

Indonesian

import { indonesianNumInWords } from 'i18n-num-in-words';
console.log(indonesianNumInWords(1234567890));

Outputs: 'satu miliar dua ratus tiga puluh empat juta lima ratus enam puluh tujuh ribu delapan ratus sembilan puluh'

English

import { englishNumInWords } from 'i18n-num-in-words';
console.log(englishNumInWords(1234567890));

Outputs: 'one billion two hundred thirty four million five hundred sixty seven thousand eight hundred ninety'

Arabic

import { arabicNumInWords } from 'i18n-num-in-words';
console.log(arabicNumInWords(1234567890));

Outputs: 'مليار واحد ومائتان وأربعة وثلاثون مليون وخمسمائة وستة وسبعون ألف وثمانمائة وتسعون'

For details, check out our full documentation.


Feel free to star us on GitHub and contribute: i18n-num-in-words GitHub Repo

About

Number utility to convert number to words in any language.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •