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

nepali-number-words

v1.1.2

Published

Convert numbers and currency amounts to Nepali words, format Nepali currency, and handle Devanagari digits.

Readme

Nepali Number & Currency Words Library

npm downloads

Try the Demo →

A lightweight, framework-independent TypeScript library for converting numbers and monetary amounts to Nepali words.

Features

  • Number to Words: Convert integers to Nepali words (e.g., 4750चार हजार सात सय पचास)
  • Amount to Words: Convert monetary amounts to Nepali currency words (e.g., 4750.50चार हजार सात सय पचास रुपैयाँ पचास पैसा मात्र)
  • Words to Number: Convert Nepali words back to numbers (experimental, e.g., एक सय100)
  • Devanagari Digits: Convert Arabic numerals to Devanagari (e.g., 4750.50४७५०.५०)
  • Currency Formatting: Format amounts with Indian/Nepali grouping (e.g., 4750रु. 4,750.00)
  • Framework Agnostic: Works with React, Vue, Node.js, Next.js, Nuxt, and any JavaScript/TypeScript project
  • TypeScript Support: Full TypeScript definitions included
  • Zero Dependencies: Pure TypeScript, no external runtime dependencies

Installation

npm install nepali-number-words

Quick Start

import {
  toNepaliWords,
  toNepaliAmount,
  toNepaliDigits,
  toNepaliText,
  formatNepaliCurrency,
  nepaliWordsToNumber,
} from "nepali-number-words";

// Convert numbers to Nepali words (shorter API)
toNepaliWords(4750); // "चार हजार सात सय पचास"
toNepaliWords(0); // "शून्य"
toNepaliWords(-100); // "ऋणात्मक एक सय"

// Convert monetary amounts to Nepali currency words (shorter API)
toNepaliAmount(4750); // "चार हजार सात सय पचास रुपैयाँ मात्र"
toNepaliAmount(4750.50); // "चार हजार सात सय पचास रुपैयाँ पचास पैसा मात्र"

// Convert digits in mixed text (shorter API)
toNepaliDigits("asjdajsd 98989as dasd s"); // "asjdajsd ९८९८९as dasd s"
toNepaliDigits("Rs. 4750.00"); // "Rs. ४७५०.००"

// Replace numbers in text with Nepali words (shorter API)
toNepaliText("Pay 4750 now"); // "Pay चार हजार सात सय पचास now"
toNepaliText("Amount 500 and fee 25"); // "Amount पाँच सय and fee पच्चीस"

// Format currency with Indian/Nepali grouping
formatNepaliCurrency(4750); // "रु. 4,750.00"
formatNepaliCurrency(4750, { devanagari: true }); // "रु. ४,७५०.००"

// Convert Nepali words back to numbers (experimental - throws on invalid input)
nepaliWordsToNumber("एक सय"); // 100
nepaliWordsToNumber("शून्य"); // 0

API Reference

toNepaliWords(value, options?)

Converts a number to Nepali words.

Parameters:

  • value: number - The number to convert
  • options?: NumberWordOptions - Conversion options

Returns: string

Options:

type NumberWordOptions = {
  // Reserved for future options
};

Examples:

toNepaliWords(0); // "शून्य"
toNepaliWords(99); // "उनान्सय"
toNepaliWords(100); // "एक सय"
toNepaliWords(4750); // "चार हजार सात सय पचास"
toNepaliWords(100000); // "एक लाख"
toNepaliWords(10000000); // "एक करोड"
toNepaliWords(1000000000); // "एक अर्ब"

toNepaliAmount(value, options?)

Converts a monetary amount to Nepali currency words.

Parameters:

  • value: number - The amount to convert
  • options?: AmountWordOptions - Conversion options

Returns: string

Options:

type AmountWordOptions = {
  appendOnly?: boolean; // Append "मात्र" at the end. Default: true
  showPaisa?: boolean; // Show paisa in the output. Default: true
  paisaSeparator?: "space" | "and"; // Separator between rupees and paisa. Default: "space"
  zeroRupeeText?: string; // Text for zero rupees. Default: "शून्य"
  chequeStyle?: boolean; // Use cheque/document formatting with extra spacing. Default: false
};

Examples:

toNepaliAmount(4750); // "चार हजार सात सय पचास रुपैयाँ मात्र"
toNepaliAmount(4750.50); // "चार हजार सात सय पचास रुपैयाँ पचास पैसा मात्र"

// Without "मात्र"
toNepaliAmount(4750, { appendOnly: false }); // "चार हजार सात सय पचास रुपैयाँ"

// With "र" separator
toNepaliAmount(4750.50, { paisaSeparator: "and" }); // "चार हजार सात सय पचास रुपैयाँ र पचास पैसा मात्र"

// Hide paisa
toNepaliAmount(4750.50, { showPaisa: false }); // "चार हजार सात सय पचास रुपैयाँ मात्र"

// Cheque style formatting
toNepaliAmount(4750, { chequeStyle: true }); // "चार  हजार  सात  सय  पचास  रुपैयाँ  मात्र"

nepaliWordsToNumber(words)

Converts Nepali words back to a number.

Experimental: This feature has limited scope and may not handle all edge cases. It throws errors for unknown words or invalid format.

Parameters:

  • words: string - The Nepali words to convert

Returns: number

Throws: Error if input contains unknown words or invalid format

Examples:

nepaliWordsToNumber("शून्य"); // 0
nepaliWordsToNumber("एक"); // 1
nepaliWordsToNumber("पचास"); // 50
nepaliWordsToNumber("एक सय"); // 100
nepaliWordsToNumber("ऋणात्मक एक सय"); // -100
nepaliWordsToNumber("चार हजार सात सय पचास"); // 4750

toNepaliDigits(value)

Converts Arabic numerals to Devanagari numerals. Non-digit text remains unchanged.

Parameters:

  • value: string | number - The value to convert

Returns: string

Examples:

toNepaliDigits("4750.50"); // "४७५०.५०"
toNepaliDigits(4750.50); // "४७५०.५०"
toNepaliDigits(12.3); // "१२.३"
toNepaliDigits("1,23,456.78"); // "१,२३,४५६.७८"
toNepaliDigits("रु. 4,750.00"); // "रु. ४,७५०.००"
toNepaliDigits("asjdajsd 98989as dasd s"); // "asjdajsd ९८९८९as dasd s"
toNepaliDigits("Invoice #12345"); // "Invoice #१२३४५"

toNepaliText(input)

Replaces standalone numbers in text with Nepali words. Non-numeric text remains unchanged. If no valid standalone numbers are found, returns the original string unchanged.

Parameters:

  • input: string - The text to transform

Returns: string

Examples:

toNepaliText("Pay 4750 now"); // "Pay चार हजार सात सय पचास now"
toNepaliText("Amount 500 and fee 25"); // "Amount पाँच सय and fee पच्चीस"
toNepaliText("asjdajsd 98989as dasd s"); // "asjdajsd 98989as dasd s" (no standalone number)
toNepaliText("Rs. 4750.50"); // "Rs. चार हजार सात सय पचास रुपैयाँ पचास पैसा मात्र"
toNepaliText("Hello world"); // "Hello world" (no numbers)

formatNepaliCurrency(value, options?)

Formats a number as Nepali currency string with Indian/Nepali grouping.

Parameters:

  • value: number - The number to format
  • options?: CurrencyFormatOptions - Formatting options

Returns: string

Options:

type CurrencyFormatOptions = {
  devanagari?: boolean; // Use Devanagari digits. Default: false
  currencySymbol?: string; // Currency symbol. Default: "रु."
  maximumFractionDigits?: number; // Maximum fraction digits. Default: 2
};

Examples:

formatNepaliCurrency(4750); // "रु. 4,750.00"
formatNepaliCurrency(4750.50); // "रु. 4,750.50"

// With Devanagari digits
formatNepaliCurrency(4750, { devanagari: true }); // "रु. ४,७५०.००"

// Custom currency symbol
formatNepaliCurrency(4750, { currencySymbol: "NPR " }); // "NPR 4,750.00"

// Custom fraction digits
formatNepaliCurrency(4750, { maximumFractionDigits: 0 }); // "रु. 4,750"

Framework Compatibility

This library is framework-agnostic and works in:

  • React
  • Vue
  • Node.js
  • Next.js
  • Nuxt
  • Plain JavaScript
  • TypeScript

React Example

import { toNepaliAmount } from "nepali-number-words";

function Invoice({ amount }: { amount: number }) {
  return (
    <div>
      <p>Amount: {amount}</p>
      <p>In words: {toNepaliAmount(amount)}</p>
    </div>
  );
}

Vue Example

<script setup lang="ts">
import { toNepaliAmount } from "nepali-number-words";

const amount = 4750.50;
</script>

<template>
  <div>
    <p>Amount: {{ amount }}</p>
    <p>In words: {{ toNepaliAmount(amount) }}</p>
  </div>
</template>

Node.js Example

import { toNepaliAmount } from "nepali-number-words";

const amount = 4750.50;
console.log(toNepaliAmount(amount));
// Output: चार हजार सात सय पचास रुपैयाँ पचास पैसा मात्र

Edge Cases

Invalid Inputs

The library throws descriptive errors for invalid inputs:

toNepaliWords(NaN); // Throws: "Invalid input: expected a finite number, received number: NaN"
toNepaliWords(Infinity); // Throws: "Invalid input: expected a finite number, received number: Infinity"
toNepaliWords("4750" as unknown as number); // Throws: "Invalid input: expected a finite number, received string: 4750"

Zero

toNepaliWords(0); // "शून्य"
toNepaliAmount(0); // "शून्य रुपैयाँ मात्र"

Negative Numbers

toNepaliWords(-4750); // "ऋणात्मक चार हजार सात सय पचास"
toNepaliAmount(-4750.50); // "ऋणात्मक चार हजार सात सय पचास रुपैयाँ पचास पैसा मात्र"

Decimal Handling

  • toNepaliWords truncates decimals
  • toNepaliAmount rounds to 2 decimal places
toNepaliWords(4750.99); // "चार हजार सात सय पचास"
toNepaliAmount(4750.555); // "चार हजार सात सय पचास रुपैयाँ पचपन्न पैसा मात्र"

Supported Number Ranges

The library supports numbers up to खर्ब (100,000,000,000):

  • सय (100)
  • हजार (1,000)
  • लाख (100,000)
  • करोड (10,000,000)
  • अर्ब (1,000,000,000)
  • खर्ब (100,000,000,000)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.