Logo Lanfrica

milytoh/nigeria-validator

Domaine:

digital infrastructure

Type de record:

softwaretools
Créateur:
mil
Hôte:
# 🇳🇬 nigeria-validator > A developer-friendly Node.js package for validating and formatting Nigerian data like phone numbers, BVNs, NINs, bank codes, states, and LGAs. --- ## ✨ Features - 📞 Phone number validation & formatting (`+234` or local) - 🏦 Bank code validation & name lookup - 🆔 BVN validation (11-digit check) - 🆔 NIN validation (11-digit national ID) - 🏛️ Validate Nigerian states and LGAs - 📡 Detect which telecom network a Nigerian phone number belongs to - 🔁 Supports both local and international formats --- ## 📦 Installation ```bash npm install nigeria-validator ``` --- ## 🔧 Usage ```js const ngv = require('nigeria-validator'); // ✅ Phone Numbers ngv.isValidPhone("08034567890"); // true ngv.formatPhone("+2348034567890"); // "08034567890" ngv.formatPhone("08034567890", "intl"); // "+2348034567890" // ✅ BVN ngv.isValidBVN("22345678901"); // true // ✅ NIN ngv.isValidNIN("12345678901"); // true // ✅ Bank Codes ngv.isValidBankCode("057"); // true ngv.getBankName("057"); // "Zenith Bank" // ✅ States and LGAs ngv.isValidState("Lagos"); // true ngv.getLGAs("Abia"); // [ 'Aba North', 'Aba South', ... ] ngv.isValidLGA("Abia", "Umuahia North"); // true // ✅ Which Network ngv.getNigerianNetwork("08034567890"); // "MTN" ``` --- ## 📘 API Reference ### 📞 Phone Numbers | Function | Description | |----------|-------------| | `isValidPhone(phone)` | Validates Nigerian mobile numbers (MTN, Airtel, Glo, 9mobile, etc.) | | `formatPhone(phone, format)` | Converts phone to `'local'` (080...) or `'intl'` (+234...) | ### 🆔 BVN | Function | Description | |----------|-------------| | `isValidBVN(bvn)` | Validates a Bank Verification Number (must be 11 digits) | ### 🆔 NIN | Function | Description | |----------|-------------| | `isValidNIN(nin)` | Validates a National Identification Number (11-digit check) | ### 🏦 Bank Codes | Function | Description | |------ …