# π³π¬ 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 |
|------ β¦