v1.0.0 · <1KB gzipped

Parse Nigerian
phone numbers

Zero-dependency TypeScript library with complete network detection, E.164 formatting, and intelligent batch processing.

Get Started
npm install phoneng
TypeScript
Zero deps
MIT License

Quick Start

Three lines of code

Import, parse, and extract any format. Network detection, validation, and formatting happen automatically.

01 Import the parse function
02 Pass any Nigerian phone number format
03 Get structured, validated output
example.ts
import { parse } from 'phoneng'

const result = parse('08031234567')

// result.e164 → '+2348031234567'
// result.network → 'MTN'
// result.type → 'MOBILE'

Capabilities

Production-ready features

0

Zero Dependencies

No external packages required. Self-contained and auditable. Ships under 1KB gzipped.

4

Network Detection

Automatically identify MTN, Airtel, Glo, and 9mobile from phone number prefixes.

TypeScript First

Complete type definitions with discriminated unions for type-safe error handling.

N

Batch Processing

Process arrays efficiently with aggregated statistics and network breakdowns.

Supported Inputs

Any format in, structured data out

Pass phone numbers in any common format. The parser normalizes input automatically before validation.

08031234567 National with trunk
+2348031234567 E.164 format
2348031234567 Compact (no +)
+234 803 123 4567 Spaced international
0803-123-4567 Hyphen separated
(0803) 123 4567 Parentheses
234-803-123-4567 Country code with hyphens
0803 1234567 Whitespace trimmed

Parse Result

Complete output from one call

Every parse returns validation status, multiple formats, and carrier metadata in a single typed object.

valid true
e164 +2348031234567
national 08031234567
international +234 803 123 4567
compact 2348031234567
rfc3966 tel:+2348031234567
prefix 0803
network MTN
type MOBILE

Network Detection

Automatic carrier identification

Every parsed number includes its carrier. Full coverage of all Nigerian mobile operators with accurate prefix mapping.

MTN

MTN

0803, 0806, 0813...

Airtel

Airtel

0802, 0808, 0812...

Glo

Glo

0805, 0807, 0815...

9mobile

9mobile

0809, 0817, 0818...

Interactive

Try it in your browser

Start parsing
in seconds

Install phoneng and add Nigerian phone number parsing to your application today.