New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

nepali-units-pro-max

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nepali-units-pro-max

नेपाली एकाइ — 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

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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

RuleWhy
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

UnitDevanagariSub-units
Ropani508.74रोपनी16 aana
Aana31.79625आना4 paisa
Paisa7.9490625पैसा4 dam
Dam1.987265625दाम

Terai system

UnitDevanagariSub-units
Bigha6772.63बिघा20 kattha
Kattha338.6315कठ्ठा20 dhur
Dhur16.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

Conversion
FunctionDescription
convert(value, from, to)Auto-category, bilingual. Throws on unknown / cross-category.
convertUnit(value, category, fromKey, toKey)Low-level. Returns NaN on unknown.
ropaniToM2 / m2ToRopaniDirect hot-path
aanaToM2 / m2ToAana
paisaToM2 / m2ToPaisa
damToM2 / m2ToDam
bighaToM2 / m2ToBigha
katthaToM2 / m2ToKattha
dhurToM2 / m2ToDhur
bighaToRopani / ropaniToBighaCross-system
Lookup
FunctionDescription
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
Parsing
FunctionDescription
parseUnit("5 ropani")Single unit: { value, key } or null
parseCompound("5 ropani 3 aana")Compound notation: { m2, system, parts } or null
safeParseUnit / safeParseCompoundSoft variants
isValidUnitInput(s)Boolean
Formatting
FunctionDescription
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
Constants

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.

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

Keywords

nepali

FAQs

Package last updated on 01 May 2026

Related posts