JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 508
  • Score
    100M100P100Q65583F
  • License MIT

The definitive, type-safe dataset of Nepal's administrative divisions with English and Nepali support.

Package Exports

  • nepali-address
  • nepali-address/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nepali-address) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

๐Ÿ‡ณ๐Ÿ‡ต nepali-address

The definitive, type-safe dataset and utility library for Nepal's administrative divisions. Built with TypeScript for modern Node.js environments.


npm version build status license downloads


๐Ÿš€ Installation

Install the package using your preferred package manager:

# npm
npm install nepali-address

# pnpm
pnpm add nepali-address

# yarn
yarn add nepali-address

# bun
bun add nepali-address

๐Ÿ“– Usage

Provinces

Retrieve all provinces or find a specific one by its ID or ISO code.

import { getProvinces, getProvinceByISOCode } from 'nepali-address';

// Get all provinces
const provinces = getProvinces();

// Get Lumbini Province by ISO code
const lumbini = getProvinceByISOCode('NP-P5');
console.log(lumbini.name_ne); // เคฒเฅเคฎเฅเคฌเคฟเคจเฅ€

Districts

Filter districts by their parent province or lookup by Postcode/ID.

import { getDistrictsByProvince, getDistrictByPostcode } from 'nepal-address';

// Get all districts in Bagmati (Province ID: 3)
const bagmatiDistricts = getDistrictsByProvince(3);

// Find a district by Postcode
const kathmandu = getDistrictByPostcode("44600");
console.log(kathmandu.name); // Kathmandu

LocalLevel

Retrieve all local levels or find a specific one by its ID, district_id, type or more.

import { getLocalLevels, getLocalLevelById, getLocalLevelsByType } from 'nepali-address';

const districts = getLocalLevels();
// โ†’ [{ id: 10101, name: 'Phaktanglung', ... }, ...]

const district = getLocalLevelById(10101);
// โ†’ { id: 10101, name: 'Phaktanglung', ... }

const missing = getLocalLevelById(1999);
// โ†’ undefined

const district = getLocalLevelsByType('rular-municipality');
// โ†’ [{ id: 10101, name: 'Phaktanglung', ... }, ...]