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

dz-id-validator

v1.0.0

Published

Zero-dependency validators for Algerian identifiers: RC, NIF, NIS, national ID (NIN), +213 phone numbers and IBAN-DZ.

Readme

dz-id-validator

Zero-dependency TypeScript validators for Algerian identifiers — RC, NIF, NIS, national ID (NIN), +213 phone numbers and IBAN-DZ.

CI npm license

🇩🇿 Built for the Algerian developer ecosystem. العربية

  • Zero dependencies — tiny, tree-shakeable, browser & Node friendly.
  • Dual ESM + CJS build with full TypeScript types.
  • Rich results — every validator returns the reason for failure and parsed metadata (wilaya, operator, BBAN…).

Install

npm install dz-id-validator

Quick start

import {
  validateIBAN,
  validatePhone,
  isValidNIF,
  validateRC,
} from "dz-id-validator";

validateIBAN("DZ16 0079 9999 0001 2345 6789");
// { valid: true, type: "iban", normalized: "DZ1600799999000123456789",
//   meta: { countryCode: "DZ", checkDigits: "16", bban: "00799999000123456789" }, errors: [] }

validatePhone("0661 23 45 67");
// { valid: true, type: "mobile", normalized: "+213661234567",
//   meta: { kind: "mobile", nsn: "661234567", e164: "+213661234567", operator: "Mobilis" }, ... }

isValidNIF("160001234567890"); // true

validateRC("16/16-0123456 B");
// { valid: true, type: "rc", normalized: "16/16-0123456 B",
//   meta: { year: "16", wilaya: "16", sequence: "0123456", legalForm: "B" }, ... }

What it validates

| Identifier | Function | Rule | | --------------------------------------------- | ------------------ | --------------------------------------------------------- | | RC — Registre du Commerce | validateRC | Structural YY/WW-SSSSSSS[ L]; embedded wilaya 0158 | | NIF — Numéro d'Identification Fiscale | validateNIF | 15 digits | | NIS — Numéro d'Identification Statistique | validateNIS | 15 digits | | NIN — National ID card (biometric) | validateNIN | 18 digits | | Mobile | validateMobile | +213 5x/6x/7x, 9-digit NSN | | Landline | validateLandline | +213 2x/3x/4x area codes | | Phone (either) | validatePhone | mobile or landline | | IBAN-DZ | validateIBAN | DZ + 24 chars, ISO 7064 MOD-97-10 |

API

Result shape

Every validate* function returns a ValidationResult:

interface ValidationResult<Meta> {
  valid: boolean;
  type: "rc" | "nif" | "nis" | "nin" | "phone" | "mobile" | "landline" | "iban";
  input: string; // original input
  normalized?: string; // canonical form (when valid)
  errors: { code: string; message: string }[];
  meta?: Meta; // parsed details
}

Boolean helpers

Prefer a quick yes/no? Use the isValid* variants:

import {
  isValidRC,
  isValidNIF,
  isValidNIS,
  isValidNIN,
  isValidPhone,
  isValidMobile,
  isValidLandline,
  isValidIBAN,
} from "dz-id-validator";

isValidMobile("+213771234567"); // true

Phone helpers

import { normalizePhone, formatPhone, toNsn } from "dz-id-validator";

normalizePhone("0661234567"); // "+213661234567"  (E.164)
formatPhone("0661234567"); // "0661 23 45 67"   (national pretty-print)
toNsn("+213661234567"); // "661234567"       (national significant number)

Accepted inputs include +213…, 00213…, 0213…, a leading trunk 0, or a bare NSN. Spaces, dots, dashes and parentheses are ignored.

IBAN helpers

import { formatIBAN, mod97 } from "dz-id-validator";

formatIBAN("DZ1600799999000123456789"); // "DZ16 0079 9999 0001 2345 6789"

Wilaya helper

import { isValidWilayaCode } from "dz-id-validator";

isValidWilayaCode(16); // true  (Algiers)
isValidWilayaCode(59); // false (Algeria has 58 wilayas)

Notes & assumptions

  • RC, NIF, NIS, NIN have no public checksum, so validation is structural (format + length + embedded wilaya range where applicable). This catches the vast majority of typos and malformed inputs.
  • IBAN-DZ: Algeria is not (yet) part of the official ISO 13616 IBAN registry. Banks issue a de-facto IBAN derived from the 20-digit RIB: DZ + 2 check digits + 20-digit BBAN = 24 characters, validated with the standard ISO 7064 MOD-97-10 checksum.
  • Mobile operator is inferred from the original number range; numbers are portable, so treat it as a hint, not a guarantee.

Development

npm install
npm run typecheck
npm test
npm run build

License

MIT © HassanMak29