indian-currency-to-words
v1.0.0
Published
Convert numbers to words (English Hindi Marathi)
Maintainers
Readme
indian-currency-to-words
Convert numbers into words using the Indian numbering system (Crore, Lakh, Thousand) with multi-language support.
Currently supported languages:
- English (
en) - Hindi (
hi) - Marathi (
mr)
Supports Rupees and Paise conversion.
✨ Features
- 🇮🇳 Indian numbering system
- 🌐 Multi-language support (
en,hi,mr) - 💰 Rupees and Paise support
- 🔢 Handles comma formatted numbers (
1,23,456) - 🔎 Input validation
- 📦 TypeScript support
- ⚡ Lightweight and fast
📦 Installation
npm install indian-currency-to-wordsor
yarn add indian-currency-to-words🚀 Usage
CommonJS
const { numberToWords } = require("indian-currency-to-words");
console.log(numberToWords(1000,"en"));Output
One Thousand Rupees OnlyES Modules
import { numberToWords } from "indian-currency-to-words";
console.log(numberToWords(1000,"en"));TypeScript
import { numberToWords } from "indian-currency-to-words";
const result = numberToWords(122876,"mr");
console.log(result);🌍 Language Examples
English
numberToWords(1123231,"en")Output
Eleven Lakh Twenty Three Thousand Two Hundred Thirty One Rupees OnlyHindi
numberToWords(1123231,"hi")Output
ग्यारह लाख तेईस हजार दो सौ इकतीस रुपये मात्रMarathi
numberToWords(1123231,"mr")Output
अकरा लाख तेवीस हजार दोनशे एकतीस रुपये फक्त💰 Decimal Support (Paise)
numberToWords(1200.50,"en")Output
One Thousand Two Hundred Rupees Fifty Paise OnlynumberToWords("1,200.75","mr")Output
एक हजार दोनशे रुपये पंच्याहत्तर पैसे फक्त🔢 Supported Input Formats
| Input | Supported |
|-----|-----|
| 1000 | ✅ |
| "1000" | ✅ |
| "1,23,456" | ✅ |
| "1200.50" | ✅ |
| "₹1,200.50" | ✅ |
| 0.75 | ✅ |
❌ Invalid Inputs
The library throws errors for invalid input.
Example:
numberToWords("abc")Error
Invalid number format🧪 Test Cases
numberToWords(0,"en")
numberToWords(1,"en")
numberToWords(100,"hi")
numberToWords("1,22,876","mr")
numberToWords(999999999,"en")
numberToWords(10000000,"en")
numberToWords(0.9,"mr")
numberToWords("₹12,450.75","en")📊 Indian Numbering System
The package uses the Indian format:
| Number | Format | |------|------| | 1,000 | Thousand | | 1,00,000 | Lakh | | 1,00,00,000 | Crore |
⚠️ Validation Rules
- Maximum 2 decimal places
- Negative numbers not supported
- Non-numeric input throws error
🛠 Example Project
const { numberToWords } = require("indian-currency-to-words");
console.log(numberToWords(1000,"en"));
console.log(numberToWords("100","hi"));
console.log(numberToWords("1,22,876","mr"));
console.log(numberToWords(1200.50,"en"));Output
One Thousand Rupees Only
सौ रुपये मात्र
एक लाख बावीस हजार आठशे शहात्तर रुपये फक्त
One Thousand Two Hundred Rupees Fifty Paise Only📌 Roadmap
Future improvements:
- More currencies
- More languages
- Billion / international system
- Browser bundle support
🤝 Contributing
Pull requests are welcome.
If you find a bug or want to improve language accuracy, please open an issue.
📄 License
MIT License
