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-id-validators-pro-max

v1.0.0

Published

🪪 Nepal ID format validators — citizenship, PAN, VAT, passport, driving license, national ID. Pure regex + parsers + canonical formatters with Devanagari-digit input tolerance.

Readme

nepali-id-validators-pro-max

नेपाली परिचय-पत्र — pro-max edition

Nepal ID format validators. Citizenship, PAN, VAT, passport, driving license, national ID — pure regex + parsers + canonical formatters with Devanagari-digit input tolerance.

npm version License: MIT TypeScript Zero deps


✨ Highlights

  • 🪪 All six common Nepal IDs — citizenship, PAN, VAT, passport (MRP + e-passport), driving license, NID
  • 🔢 Devanagari digits accepted on every field — १२३४५६७८९ works as well as 123456789
  • 🧹 Format-agnostic input-, /, spaces, mixed Devanagari/ASCII all normalised
  • 📋 Parsers + formatters — get structured details and a canonical string
  • 🔍 detectIDType — best-effort routing for KYC pipelines that accept "any Nepal ID"
  • 🚫 Format-only validation — we don't claim to verify issuance (that needs the relevant authority's database)
  • 📦 Zero deps · ESM + CJS · TypeScript-first · tree-shakeable

📦 Install

npm install nepali-id-validators-pro-max
pnpm add nepali-id-validators-pro-max
yarn add nepali-id-validators-pro-max
bun add nepali-id-validators-pro-max

⚡ Quick Start

import {
  isValidCitizenship,
  isValidPAN,
  isValidVAT,
  isValidPassport,
  isValidDrivingLicense,
  isValidNID,
  detectIDType,
} from "nepali-id-validators-pro-max";

isValidCitizenship("12-01-78-12345");   // true
isValidPAN("301234567");                  // true
isValidVAT("301234567");                  // true (alias of PAN)
isValidPassport("M1234567");              // true (MRP, letter + digits)
isValidPassport("11936491");              // true (MRP, all-numeric)
isValidPassport("PA1234567");             // true (e-passport)
isValidDrivingLicense("12-04-12345678"); // true (district 12)
isValidNID("1234567890");                 // true (10 bare digits)

detectIDType("PA1234567");                 // "passport"
detectIDType("12-01-78-12345");            // "citizenship"
detectIDType("12-04-12345678");            // "driving-license" (8-digit sequence)

🧠 Mental Model

| Rule | Why | |---|---| | Format only — never issuance. | Real verification needs CDO / IRD / DoP / DoTM / NIDMC databases. We do regex + structural checks. | | Devanagari digits are normalised. | A user typing १२३ should validate identically to 123. | | Separators are normalised (where used). | Citizenship and DL accept -, /, spaces; canonical output uses -. | | DL and citizenship both use district code [1, 77]. | DL is disambiguated by sequence length (last group ≥ 7 digits); citizenship sequences are typically shorter. | | NID is bare 10 digits. | The government publishes no canonical separator format, so any grouping would collide with citizenship/DL. | | PAN is bare 9 digits. | No separators — they would collide with grouped citizenship numbers. | | detectIDType is best-effort. | Prefer the specific isValid* when you know the type. |


📋 ID format reference

| ID | Format | Example | |---|---|---| | Citizenship | 2-4 numeric groups, first = district code [1, 77] | 12-01-78-12345 | | PAN / VAT | 9 bare digits (no separators) | 301234567 | | Passport (MRP) | 0 or 1 uppercase letter + 7-8 digits | M1234567, 11936491 | | Passport (e-passport) | 2 uppercase letters + 6-8 digits | PA1234567 | | Driving license | 2-4 numeric groups, first = district [1, 77], last ≥ 7 digits | 12-04-12345678 | | NID | 10 bare digits (no separators) | 1234567890 |


🧰 Full API

| Function | Description | |---|---| | isValidCitizenship(input) | Boolean format check | | parseCitizenship(input) | CitizenshipDetails \| null | | formatCitizenship(details) | Canonical hyphenated string |

CitizenshipDetails: { raw, canonical, groups, districtCode?, sequence }

| Function | Description | |---|---| | isValidPAN(input) / isValidVAT(input) | Boolean (VAT is an alias of PAN — same 9-digit field) | | parsePAN(input) / parseVAT(input) | PANDetails \| null | | formatPAN(details) / formatVAT(details) | Canonical 9-digit string |

PANDetails: { raw, digits }

| Function | Description | |---|---| | isValidPassport(input) | Boolean (MRP or e-passport) | | parsePassport(input) | PassportDetails \| null | | formatPassport(details) | Canonical uppercase form |

PassportDetails: { raw, canonical, type: "MRP" \| "e-passport", prefix, sequence }

| Function | Description | |---|---| | isValidDrivingLicense(input) | Boolean (post-2017 smart-card format) | | parseDrivingLicense(input) | DrivingLicenseDetails \| null | | formatDrivingLicense(details) | Canonical hyphenated string |

DrivingLicenseDetails: { raw, canonical, groups, districtCode, sequence }

| Function | Description | |---|---| | isValidNID(input) | Boolean (bare 10 digits — no separators) | | parseNID(input) | NIDDetails \| null | | formatNID(details) | Bare 10-digit string |

NIDDetails: { raw, digits }

| Function | Description | |---|---| | detectIDType(input) | "passport" \| "nid" \| "pan" \| "driving-license" \| "citizenship" \| null |


🎯 Recipes

KYC form validation

import { isValidCitizenship, isValidPAN, isValidPassport } from "nepali-id-validators-pro-max";

const errors: string[] = [];
if (!isValidCitizenship(form.citizenship)) errors.push("Invalid citizenship number");
if (form.pan && !isValidPAN(form.pan)) errors.push("Invalid PAN");
if (form.passport && !isValidPassport(form.passport)) errors.push("Invalid passport number");

Universal "any Nepal ID" intake

import { detectIDType } from "nepali-id-validators-pro-max";

const idType = detectIDType(userInput);
if (!idType) throw new Error("Unrecognised ID format");
console.log(`Looks like a ${idType}`);

Normalise stored IDs to canonical form

import { parseCitizenship, formatCitizenship } from "nepali-id-validators-pro-max";

const cleaned = parseCitizenship(userInput);
if (cleaned) {
  await db.users.update({ id, citizenship: formatCitizenship(cleaned) });
}

Devanagari-digit form input

import { isValidPAN } from "nepali-id-validators-pro-max";

isValidPAN("३०१२३४५६७");   // true — Devanagari digits handled transparently

🤝 Contributing

PRs welcome. Common contributions:

  • Edge-case formats discovered in the wild (older citizenship layouts, regional CDO variants)
  • Pre-2017 driving license format (separate parseLegacyDrivingLicense)
  • Checksum logic if NIDMC / IRD ever publish one for NID or PAN
npm install
npm test
npm run typecheck
npm run build

📜 License

MIT © 2026 l3lackcurtains


Made with ❤️ for the Nepali developer community.

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