1.2.0 • Published 11 months ago

@heartinz/amount_to_words v1.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

@heartinz/amount_to_words

@heartinz/amount_to_words is a Node.js module that converts numeric values into their corresponding word representations in various currencies, specifically designed for Indian Rupees (INR) but extendable to other currencies. This utility is ideal for applications such as financial reports, invoices, billing systems, or anywhere numerical values need to be expressed in words.

Features

  • Multi-Locale Support: Convert numbers to words in a variety of locales.
  • Currency Formatting: Specifically formatted for currency representations, including Rupees and Paise for INR.
  • Customization: Easily extendable to support additional currencies and locales.
  • Camel Casing: Ensures that each word starts with a capital letter for better readability.

Installation

Ensure you have Node.js installed on your machine. Then, install the @heartinz/amount_to_words package using npm:

npm install @heartinz/amount_to_words


const { amountToWords } = require('@heartinz/amount_to_words');

// Example: Convert amount in Indian Rupees
console.log(amountToWords(1234.56, 'INR'));
// Output: "One Thousand Two Hundred Thirty-Four Rupees and Fifty-Six Paise Only"

console.log(amountToWords(100, 'INR'));
// Output: "One Hundred Rupees Only"

console.log(amountToWords(50.05, 'INR'));
// Output: "Fifty Rupees and Five Paise Only"



## Supported Locale

| Country             | Language  | Locale  | Currency Code |
|---------------------|-----------|---------|---------------|
| UAE                 | English   | en-AE   | AED           |
| Bangladesh          | English   | en-BD   | BDT           |
| UK                  | English   | en-GB   | GBP           |
| Ghana               | English   | en-GH   | GHS           |
| Ireland             | English   | en-IE   | EUR           |
| India               | English   | en-IN   | INR           |
| Myanmar             | English   | en-MM   | MMK           |
| Mauritius           | English   | en-MU   | MUR           |
| Nigeria             | English   | en-NG   | NGN           |
| Nepal               | English   | en-NP   | NPR           |
| USA                 | English   | en-US   | USD           |
| Philippines         | English   | en-PH   | PHP           |
| Estonia             | Estonian  | ee-EE   | EUR           |
| Iran                | Persian   | fa-IR   | IRR           |
| Belgium             | French    | fr-BE   | EUR           |
| France              | French    | fr-FR   | EUR           |
| India               | Gujarati  | gu-IN   | INR           |
| India               | Hindi     | hi-IN   | INR           |
| India               | Marathi   | mr-IN   | INR           |
| Suriname            | Dutch     | nl-SR   | SRD           |
| Brazil              | Portuguese| pt-BR   | BRL           |
| Turkey              | Turkish   | tr-TR   | TRY           |
| Korean, Republic of | Hangul    | ko-KR   | KRW           |
1.2.0

11 months ago

1.1.0

11 months ago