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

get-nepali-number

v0.3.0

Published

Convert any english (Hindu-Arabic) numeral to a Nepali (Devanagari) numeral with Lakh/Crore grouping

Readme

get-nepali-number

CI npm

Convert any english (technically Hindu-Arabic) numeral to a Nepali (Devanagari) numeral, grouped the Nepali way (Lakh/Crore).

  • Zero dependencies, no Intl/ICU needed, works in Node (>= 22) and every browser.
  • Ships ESM, CommonJS and TypeScript declarations.
  • Keeps the sign of negative numbers, handles bigint and arbitrarily long numeric strings.

Install

npm install get-nepali-number
# or
yarn add get-nepali-number
# or
pnpm add get-nepali-number

Usage

// ESM / TypeScript
import getNepaliNumber from 'get-nepali-number';

// CommonJS
const getNepaliNumber = require('get-nepali-number');

getNepaliNumber(100);
//=> '१००'

getNepaliNumber(2000);
//=> '२,०००'

getNepaliNumber(200.05);
//=> '२००.०५'

getNepaliNumber(2000.5);
//=> '२,०००.५'

getNepaliNumber('2,00,000.50');
//=> '२,००,०००.५'

getNepaliNumber('1,000,365.50');
//=> '१०,००,३६५.५'

getNepaliNumber(-42);
//=> '-४२'

getNepaliNumber(12345678901234567890n);
//=> '१,२३,४५,६७,८९,०१,२३,४५,६७,८९०'

getNepaliNumber(1000365, { grouping: false });
//=> '१०००३६५'

The named exports are available too:

import { getNepaliNumber, toDevanagariDigits, fromDevanagariDigits } from 'get-nepali-number';

toDevanagariDigits('Room 42, floor 3');
//=> 'Room ४२, floor ३'

fromDevanagariDigits('१०,००,३६५.५');
//=> '10,00,365.5'

API

getNepaliNumber(input, options?)

Returns a string with Devanagari digits.

input

Type: number | string | bigint

The value to convert. Strings may contain thousands separators (,) in any position (they are removed and the number is regrouped), surrounding whitespace, a leading +/- sign and even Devanagari digits. Leading zeros in the integer part and trailing zeros in the fraction are dropped ('007.50' → '७.५').

Throws a TypeError for anything that is not a finite number or a numeric string: NaN, Infinity, '', 'abc', '1e5', null, undefined, objects, etc.

options

Type: object

grouping

Type: boolean
Default: true

Insert Lakh/Crore separators into the integer part (the last three digits form one group, every two digits after that form another: 1000365 → 10,00,365). Set to false to only swap the digits.

toDevanagariDigits(input)

Type: (input: string | number | bigint) => string

Replaces every 0-9 with the matching Devanagari digit and leaves everything else untouched. No grouping, trimming or validation is done, so use it when you want to format the number yourself.

fromDevanagariDigits(input)

Type: (input: string) => string

The inverse of toDevanagariDigits: replaces every ०-९ with the matching Hindu-Arabic digit and leaves everything else untouched.

TypeScript

Types are bundled. The GetNepaliNumberOptions and NumberInput types are exported for convenience:

import getNepaliNumber, { type GetNepaliNumberOptions } from 'get-nepali-number';

const options: GetNepaliNumberOptions = { grouping: false };
const price: string = getNepaliNumber(1999.99, options);

Supported Node.js versions

The package requires Node.js 22 or newer (engines.node >= 22) and is tested on Node 22, 24 and 26 in CI. The published code is plain ES2020 with no runtime dependencies, so it also runs in any evergreen browser. An .nvmrc pins the development version to 26.

Development

npm install
npm run typecheck   # tsc --noEmit
npm run lint        # eslint + prettier --check
npm test            # vitest
npm run build       # tsup -> dist/ (esm, cjs, d.ts)

License

MIT © techgaun