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-units-pro-max

v1.0.0

Published

नेपाली एकाइ — Nepali traditional units (ropani, aana, paisa, dam, bigha, kattha, dhur) plus standard length / weight / area / volume / temperature. Compound notation parser/formatter (`5 ropani 3 aana 2 paisa` ↔ m²), bilingual lookups, Devanagari digit su

Downloads

105

Readme

nepali-units-pro-max

नेपाली एकाइ — pro-max edition

Traditional Nepali land units (ropani, aana, paisa, dam, bigha, kattha, dhur) plus standard length / weight / area / volume / temperature. Compound notation parser/formatter (5 ropani 3 aana 2 paisa ↔ m²), bilingual lookups, Devanagari digit support.

npm version License: MIT TypeScript Zero deps ESM + CJS


✨ Highlights

  • 🇳🇵 Nepal-first — full hill (ropani) + Terai (bigha) systems with Survey Department factors
  • 📐 Compound notation — parse "5 ropani 3 aana 2 paisa" and format m² back into compound form
  • 🌐 Bilingual lookupsgetUnit("ropani"), getUnit("रोपनी"), getUnit("Bigha"), getUnit("कठ्ठा") all just work
  • 🔢 Devanagari digitsparseUnit("५.२५ रोपनी") works out of the box
  • 📦 Zero deps, tree-shakeable, ESM + CJS, TypeScript-first
  • 🌡️ Temperature uses real formulas (not multiplicative toBase)

📦 Install

npm install nepali-units-pro-max
pnpm add nepali-units-pro-max
yarn add nepali-units-pro-max
bun add nepali-units-pro-max

⚡ Quick Start

import {
  convert,
  parseCompound,
  formatCompound,
  ropaniToM2,
  m2ToBigha,
  formatUnit,
} from "nepali-units-pro-max";

// Direct conversion (auto-category, bilingual)
convert(1, "ropani", "m2");                 // 508.74
convert(1, "बिघा", "वर्ग मिटर");              // 6772.63
convert(100, "c", "f");                     // 212

// Direct land helpers (hot path)
ropaniToM2(2.5);                            // 1271.85
m2ToBigha(13545.26);                        // 2.0

// Compound notation (the headline)
parseCompound("5 ropani 3 aana 2 paisa").m2;  // ~2654.99
parseCompound("१ बिघा १० कठ्ठा").m2;            // ~10158.95
formatCompound(2654.99);                       // "5 Ropani 3 Aana 2 Paisa"
formatCompound(10158.95, { system: "terai", locale: "ne" });
// "१ बिघा १० कठ्ठा"

// Display
formatUnit(5.25, "ropani", { locale: "ne" });   // "5.25 रोपनी"

🧠 Mental Model

| Rule | Why | |---|---| | Hill system: 1 ropani = 16 aana = 64 paisa = 256 dam (= 508.74 m²) | Used in Kathmandu valley + hill regions. | | Terai system: 1 bigha = 20 kattha = 400 dhur (= 6772.63 m²) | Used in southern plains. | | convert(value, from, to) auto-detects category and rejects cross-category. | Saves you from convertUnit(v, "area", ...) boilerplate. | | parseCompound("5 ropani 3 aana") always returns m2. | m² is the only meaningful base for compound land notation. | | formatCompound(m2) defaults to hill system. | Most apps targeting Kathmandu / hill region just want this. Pass { system: "terai" } for plains. | | Bilingual lookup is case- and diacritic-tolerant. | "Ropani", "ropani", "रोपनी", "ropani." all match. | | Temperature uses formulas, not factors. | Celsius / Fahrenheit / Kelvin can't be multiplied to a common base. |


📐 Conversion factors (Survey Department)

Hill system

| Unit | m² | Devanagari | Sub-units | |---|---|---|---| | Ropani | 508.74 | रोपनी | 16 aana | | Aana | 31.79625 | आना | 4 paisa | | Paisa | 7.9490625 | पैसा | 4 dam | | Dam | 1.987265625 | दाम | — |

Terai system

| Unit | m² | Devanagari | Sub-units | |---|---|---|---| | Bigha | 6772.63 | बिघा | 20 kattha | | Kattha | 338.6315 | कठ्ठा | 20 dhur | | Dhur | 16.931575 | धुर | — |

Cross-system: 1 bigha ≈ 13.31 ropani.


🧩 Compound Notation

The headline feature. Real-world Nepal real-estate listings often look like:

  • "5 ropani 3 aana 2 paisa 1 dam" (hill)
  • "1 bigha 5 kattha 10 dhur" (Terai)
// Parse
parseCompound("5 ropani 3 aana 2 paisa");
// {
//   m2: 2654.99,
//   system: "hill",
//   parts: [
//     { value: 5, key: "ropani" },
//     { value: 3, key: "aana" },
//     { value: 2, key: "paisa" },
//   ],
//   raw: "5 ropani 3 aana 2 paisa",
// }

parseCompound("१ बिघा १० कठ्ठा");      // Devanagari works
parseCompound("2.5 ropani");           // decimals work
parseCompound("1 ropani 2 kattha");    // mixed system flagged

// Format (m² → compound)
formatCompound(2654.99);                                 // "5 Ropani 3 Aana 2 Paisa"
formatCompound(2654.99, { locale: "ne" });               // "५ रोपनी ३ आना २ पैसा"
formatCompound(10158.95, { system: "terai" });           // "1 Bigha 5 Kattha 10 Dhur"
formatCompound(508.74 * 5);                              // "5 Ropani"  (zero segments skipped)

formatCompound always picks maximal sub-units — i.e., as many ropani as fit, then aana, then paisa, then dam. The smallest sub-unit absorbs any fractional remainder.


🧰 Full API

| Function | Description | |---|---| | convert(value, from, to) | Auto-category, bilingual. Throws on unknown / cross-category. | | convertUnit(value, category, fromKey, toKey) | Low-level. Returns NaN on unknown. | | ropaniToM2 / m2ToRopani | Direct hot-path | | aanaToM2 / m2ToAana | | | paisaToM2 / m2ToPaisa | | | damToM2 / m2ToDam | | | bighaToM2 / m2ToBigha | | | katthaToM2 / m2ToKattha | | | dhurToM2 / m2ToDhur | | | bighaToRopani / ropaniToBigha | Cross-system |

| Function | Description | |---|---| | getUnit(query) | By key / English / Devanagari / alias | | getCategoryOf(query) | "length" \| "weight" \| "area" \| "volume" \| "temperature" | | getUnitsForCategory(category) | All units in a category | | getCategories() | All 5 categories | | getTraditionalNepaliUnits() | The 7 hill + Terai area units |

| Function | Description | |---|---| | parseUnit("5 ropani") | Single unit: { value, key } or null | | parseCompound("5 ropani 3 aana") | Compound notation: { m2, system, parts } or null | | safeParseUnit / safeParseCompound | Soft variants | | isValidUnitInput(s) | Boolean |

| Function | Description | |---|---| | formatCompound(m2, opts?) | m² → "5 Ropani 3 Aana 2 Paisa" | | formatUnit(value, unitQuery, opts?) | "5.25 Ropani" | | formatConvertedValue(value) | Magnitude-aware precision, trailing-zero trim |

ROPANI_TO_M2, AANA_TO_M2, PAISA_TO_M2, DAM_TO_M2, BIGHA_TO_M2, KATTHA_TO_M2, DHUR_TO_M2, HILL_SYSTEM_KEYS, TERAI_SYSTEM_KEYS, LENGTH_UNITS, WEIGHT_UNITS, AREA_UNITS, VOLUME_UNITS, TEMPERATURE_UNITS, CATEGORY_LABELS.


🎯 Recipes

Real-estate listing input

import { parseCompound, formatCompound } from "nepali-units-pro-max";

const userInput = "5 ropani 3 aana 2 paisa";
const parsed = parseCompound(userInput);
if (parsed) {
  console.log(`Total: ${parsed.m2.toFixed(2)} m²`);
  // Save canonical m² to the database; reformat for display in any system.
  console.log(`In Terai notation: ${formatCompound(parsed.m2, { system: "terai" })}`);
}

Bilingual area display

import { ropaniToM2, formatUnit } from "nepali-units-pro-max";

const m2 = ropaniToM2(5);
console.log(formatUnit(5, "ropani"));                 // "5 Ropani"
console.log(formatUnit(5, "ropani", { locale: "ne" })); // "5 रोपनी"
console.log(formatUnit(m2, "m2"));                    // "2543.7 Square metre"

Temperature converter

import { convert } from "nepali-units-pro-max";

convert(36.5, "c", "f");    // 97.7  (body temperature)
convert(0, "c", "k");       // 273.15
convert(100, "f", "c");     // 37.778

User-typed unit picker

import { getUnit, getCategoryOf, convert } from "nepali-units-pro-max";

function safeConvert(value: number, from: string, to: string) {
  const fromUnit = getUnit(from);
  const toUnit = getUnit(to);
  if (!fromUnit || !toUnit) return null;
  if (getCategoryOf(from) !== getCategoryOf(to)) return null;
  return convert(value, from, to);
}

safeConvert(5, "रोपनी", "बिघा");   // ~0.376

🤝 Contributing

PRs welcome. Common contributions:

  • Additional unit aliases / spelling variants
  • Bug fixes, type improvements, documentation polish
  • New compound-notation tolerances (e.g., "1.5 बिघा", mixed-script inputs)
npm install
npm test
npm run typecheck
npm run build

📜 License

MIT © 2026 l3lackcurtains


Made with ❤️ for the Nepali developer community.

बनाइएको नेपाली डेभलपर समुदायको लागि।