Logo Lanfrica

lintdeveloper/naija-id

Domaine:

digital infrastructure

Type de record:

softwaretools
Créateur:
lin
Hôte:
Zero-dependency TypeScript validators, formatters and PII redaction for 14 Nigerian identifiers — phone, NIN, vNIN, BVN, Tax ID, TIN, CAC, NUBAN, plate, passport, driver's licence, RSA PIN, voter VIN # naija-id Typed, zero-dependency validators, formatters and PII redaction for **14 Nigerian identifiers**. Optional **Zod**; zero-dependency **Standard Schema**. ```sh npm i naija-id ``` ```ts import { isPhone, formatPhone, fixedLineArea, detect } from "naija-id"; isPhone("0803 123 4567"); // true formatPhone("08031234567", "national"); // "0803 123 4567" fixedLineArea("02084 123 456"); // "Port Harcourt" detect("02012345678"); // "fixed-line" ``` > **Validates format, not existence.** NUBAN's CBN check digit is the one real checksum here — > everything else is structural. Use it as a cheap offline pre-check before an authority call > (NIMC, NIBSS, CAC, NRS, INEC), and for form validation. **Contents** — What's included · Core API · Redact · Notes per identifier · Zod · Standard Schema ## What's included | Identifier | Validate | Format | Generate | `detect()` | Redacted by default? | | --- | --- | --- | --- | --- | --- | | Phone (mobile) | `isPhone` | `formatPhone` | `generatePhone` | `phone` | ✅ prefixed form | | Fixed-line | `isFixedLine` | `formatFixedLine` | `generateFixedLine` | `fixed-line` | ✅ | | NIN | `isNin` | `formatNin` | `generateNin` | `nin-or-bvn` | opt-in | | BVN | `isBvn` | `formatBvn` | `generateBvn` | `nin-or-bvn` | opt-in | | vNIN | `isVnin` | `formatVnin` | `generateVnin` | `vnin` | ✅ | | Tax ID (13-digit) | `isTaxId` | `formatTaxId` | `generateTaxId` | `tax-id` | opt-in | | TIN (legacy) | `isTin` | `formatTin` | `generateTin` | `tin` | opt-in | | NUBAN | `isValidNuban` | `formatNuban` | `generateNuban` | — | needs `bankCodes` | | CAC | `isCac` | `formatCac` | `generateCac` | `cac` | opt-in | | Plate | `isPlate` | `formatPlate` | `generatePlate` | `plate` | ✅ | | Passport | `isPassport` | `formatPassport` | `generatePassport` | `passport` | opt-in | | Driver's licence | `isDriverLicense` | `formatDriverLicense` | `generateDriverLicense` | `driver-license` | ✅ | | RSA PIN | `isRsaPin` | `fo …