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

@silentcoderhi/pk-validate

v1.0.0

Published

Zero-dependency structural validators for Pakistani CNICs, mobile numbers, NTN, postal codes, and IBANs.

Readme

pk-validate

Zero-dependency utilities for structural validation and formatting of Pakistani CNICs, mobile numbers, NTN formats, postal codes, and IBANs. These checks do not confirm identity, registration, account existence, ownership, or reachability.

import { cnic, phone, ntn, postalCode, iban } from "@silentcoderhi/pk-validate";

cnic.isValid("35202-1234567-1"); // true
cnic.normalize("3520212345671"); // "35202-1234567-1"
cnic.mask("35202-1234567-1"); // "35202-*******-1"

phone.isValid("+92 300 1234567"); // true
phone.normalize("0300-1234567"); // "+923001234567"
phone.format("+923001234567"); // "0300-1234567"

ntn.format("12345678"); // "1234567-8"
postalCode.isValid("44000"); // true
iban.format("PK36SCBL0000001123456702"); // "PK36 SCBL 0000 0011 2345 6702"

Install

npm install @silentcoderhi/pk-validate

API

| Module | Method | Result | | --- | --- | --- | | cnic | isValid(value) | Whether input has 13 digits, optionally 12345-1234567-1 | | cnic | normalize(value) / format(value) | Canonical dashed form or null | | cnic | mask(value) | Masks the seven middle digits or null | | phone | isValid(value) | Whether input matches a Pakistani mobile-number shape | | phone | normalize(value) | E.164 form (+923xxxxxxxxx) or null | | phone | format(value) | Local form (03xx-xxxxxxx) or null | | ntn | isValid(value) | 8 digits or 13-digit CNIC-based individual NTN shape | | ntn | format(value) | 1234567-8 or CNIC-style dashed form, otherwise null | | postalCode | isValid(value) | Five digits, not starting with zero; format check only | | iban | isValid(value) | Pakistani 24-character structure and mod-97 checksum | | iban | format(value) | Valid IBAN grouped in fours, otherwise null | | iban | bankCode(value) | Four-letter bank code from a valid IBAN, otherwise null |

Phone inputs may use local 03xxxxxxxxx, international +923xxxxxxxxx, or international access prefix 00923xxxxxxxxx; spaces, parentheses, periods, and hyphens are accepted as separators. normalize and formatting methods return null for invalid input.

Privacy and accuracy

  • CNICs are sensitive personal data. Avoid logging them; use cnic.mask() when displaying a CNIC.
  • Validation checks shape only. It cannot verify an identity, issuance, ownership, assignment, or reachability.
  • NTN checks recognize common 8-digit and individual CNIC-based 13-digit shapes only; they do not confirm FBR registration or apply an undocumented checksum.
  • Postal-code validation checks a five-digit pattern only; it does not confirm that a postal code exists.
  • IBAN validation checks Pakistani structure and the standard mod-97 checksum only; it does not confirm that an account exists or is active. Example IBANs are synthetic test values, not account claims.
  • Carrier lookup is intentionally excluded: number portability and lack of a maintained authoritative prefix source make a carrier result unreliable.

Development

npm install
npm run dev
npm test
npm run typecheck
npm run build

npm run dev launches the local React + Vite site. The Home page is at /, with matching branded pages at /playground.html, /about.html, and /docs.html. The Playground imports the same source modules as the package and processes input entirely in the browser. Use synthetic values only.

Vercel build settings and clean route rewrites (/playground, /about, /docs) are in vercel.json.

The npm package publishes only the built library and package essentials (dist/, README.md, and LICENSE), as restricted by the files allowlist in package.json; .npmignore additionally excludes website, test, and development files. The repository .gitignore is separate and does not control npm package contents.

See CONTRIBUTING.md for contribution guidance. Changes follow Keep a Changelog and semantic versioning.