npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rupee-india

v1.0.4

Published

Indian Rupee formatter for Node.js — format numbers with Indian comma system, convert to words, lakhs and crores

Readme

rupee-india

🇮🇳 A lightweight, zero-dependency Indian Rupee formatter for Node.js

Format numbers using the Indian numbering system (thousand, lakh, crore), convert amounts to words, and display with the ₹ symbol — all without any external dependencies.

npm version License: MIT Node.js


✨ Features

  • 🔢 Indian comma grouping — formats numbers as 1,00,000 instead of 100,000
  • 💰 Rupee symbol — prefix with ₹ in one call
  • 🗣️ Number to words"One Lakh Rupees" with paise support
  • 📊 Lakh / Crore helpers — express values in lakh or crore units
  • Zero dependencies — lightweight and fast
  • 🛡️ Input validation — descriptive errors for invalid input
  • 🧩 CommonJS — works with require() out of the box (Node.js 16+)

Installation

npm install rupee-india

Quick Start

const rupee = require("rupee-india");

rupee.format(1000000);           // "10,00,000"
rupee.formatWithSymbol(50000);   // "₹50,000"
rupee.toWords(1250);             // "One Thousand Two Hundred Fifty Rupees"
rupee.lakhs(1000000);            // "10 Lakh"
rupee.crores(10000000);          // "1 Crore"

API Reference

format(number)

Converts a number to a string with Indian comma grouping (groups of 3 then 2 from the right).

| Parameter | Type | Description | |-----------|------|-------------| | number | number \| string | The number to format |

Returns: string — comma-formatted number.

rupee.format(1000);        // "1,000"
rupee.format(100000);      // "1,00,000"
rupee.format(10000000);    // "1,00,00,000"
rupee.format(1234567890);  // "1,23,45,67,890"
rupee.format(-50000);      // "-50,000"
rupee.format(1234.56);     // "1,234.56"
rupee.format("100000");    // "1,00,000"  (string input)

formatWithSymbol(number)

Same as format() but prefixed with the Rupee symbol.

| Parameter | Type | Description | |-----------|------|-------------| | number | number \| string | The number to format |

Returns: string — formatted number with ₹ prefix.

rupee.formatWithSymbol(100000);   // "₹1,00,000"
rupee.formatWithSymbol(0);        // "₹0"
rupee.formatWithSymbol(-500);     // "-₹500"
rupee.formatWithSymbol(10000000); // "₹1,00,00,000"

toWords(number)

Converts a number to Indian-English currency words. Supports paise (up to 2 decimal places) and negative numbers.

| Parameter | Type | Description | |-----------|------|-------------| | number | number \| string | The number to convert |

Returns: string — human-readable currency string.

rupee.toWords(0);          // "Zero Rupees"
rupee.toWords(1500);       // "One Thousand Five Hundred Rupees"
rupee.toWords(100000);     // "One Lakh Rupees"
rupee.toWords(10000000);   // "One Crore Rupees"
rupee.toWords(1234567);    // "Twelve Lakh Thirty Four Thousand Five Hundred Sixty Seven Rupees"
rupee.toWords(21.50);      // "Twenty One Rupees and Fifty Paise"
rupee.toWords(-500);       // "Minus Five Hundred Rupees"

lakhs(number)

Express a number in Lakh units (1 Lakh = 1,00,000).

| Parameter | Type | Description | |-----------|------|-------------| | number | number \| string | The number to convert |

Returns: string — value in lakhs with label.

rupee.lakhs(100000);   // "1 Lakh"
rupee.lakhs(1000000);  // "10 Lakh"
rupee.lakhs(250000);   // "2.5 Lakh"
rupee.lakhs(50000);    // "0.5 Lakh"

crores(number)

Express a number in Crore units (1 Crore = 1,00,00,000).

| Parameter | Type | Description | |-----------|------|-------------| | number | number \| string | The number to convert |

Returns: string — value in crores with label.

rupee.crores(10000000);   // "1 Crore"
rupee.crores(100000000);  // "10 Crore"
rupee.crores(75000000);   // "7.5 Crore"

Error Handling

All functions validate their input and throw descriptive errors:

rupee.format("abc");       // TypeError: Expected a number ...
rupee.format(Infinity);    // RangeError: Number must be finite ...
rupee.format(null);        // TypeError: Expected a number ...
rupee.format(undefined);   // TypeError: Expected a number ...

Running Tests

npm test

Project Structure

rupee-india/
├── package.json
├── README.md
├── LICENSE
├── index.js          # Main entry point — re-exports all functions
├── src/
│   ├── format.js     # format, formatWithSymbol, lakhs, crores
│   ├── words.js      # toWords (number → Indian-English currency words)
│   └── helpers.js    # Input validation & shared utilities
└── test/
    └── test.js       # Comprehensive test suite

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request on the GitHub repository.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m "Add my feature")
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

Author

Dheeraj SinghGitHub

License

MIT © 2026 Dheeraj Singh