Logo Lanfrica
  • Accueil
  • Atlas
  • Analyses
  • Documentation
  • Sign in

© 2026 Lanfrica. Tous droits réservés. Tous les droits d'auteur des ressources affichées sur le site Web Lanfrica appartiennent aux détenteurs de droits d'auteur d'origine, sauf indication contraire explicite.

bassmoses/africa-phone

Domaine:

digital infrastructure

Type de record:

softwaretools
Créateur:
bas
Hôte:
Offline-first parsing, validation, normalization, and mobile network/carrier detection for African phone numbers. # africa-phone **African-first phone number parsing, validation, normalization, and mobile network/carrier detection — 100% offline, zero runtime dependencies.** ```ts import { parsePhone } from 'africa-phone'; parsePhone('08031234567', 'NG'); // { // input: '08031234567', iso2: 'NG', countryCallingCode: '234', // nationalNumber: '8031234567', e164: '+2348031234567', // national: '0803 123 4567', international: '+234 803 123 4567', // isPossible: true, isValid: true, validationIssue: 'NONE', // network: { // operatorId: 'ng-mtn', name: 'MTN Nigeria', brand: 'MTN', // mobileMoney: 'MTN MoMo', ussd: { balance: '*556#', buyAirtime: '*312#', data: '*131#' }, // portedNumberPossible: true, // }, // } ``` ## Why not libphonenumber-js? General-purpose libraries validate length and formatting for every country on Earth, but treat African numbers as an afterthought — none of them tell you the _carrier_, whether a mobile money product exists on that network, or which USSD code checks the balance. `africa-phone` is built the other way around: a small set of African countries, covered deeply. - **Carrier/network detection** — MTN, Airtel, Safaricom, Vodacom, and more, from the number prefix. - **Mobile money awareness** — M-Pesa, MTN MoMo, Airtel Money, Orange Money, T-Kash, telebirr, and others, mapped per operator. - **Extensible USSD codes** — balance-check and other shortcodes per operator. - **Honest about number portability** — where a country has mandated mobile number portability (Nigeria, Kenya, and others), results carry a `portedNumberPossible` flag instead of silently pretending prefix-based carrier detection is ground truth. - **Fully offline** — no network calls, works identically in Node and the browser. ## Install ```sh npm install africa-phone ``` ## Quick start ```ts import { parsePhone, isValidPhone, getNetwork, normalize, getPhoneInfo } from 'africa-phone'; parsePhone('+254712345678'); // iso2: 'KE', network.brand: 'Saf …

Visit

github.com

Licenses

MIT