Somalia (+252) phone validator, formatter, and operator guesser. Library + CLI.
# πΈπ΄ sophone
**Professional Somali phone number validation, formatting, operator detection & mobile wallet identification**
A comprehensive JavaScript/TypeScript library for working with Somali phone numbers. Validate, format, identify operators, and detect mobile money wallets (EVC, Sahal, ZAAD, eDahab, Jeeb) for Somalia (+252) phone numbers with beautiful error handling and TypeScript support.
## β¨ Features
- π **Validate** Somali phone numbers in any format
- π¨ **Format** numbers to E.164, local, or international format
- π± **Identify operators** (Hormuud, Somtel, Telesom, etc.)
- π° **Detect mobile wallets** (EVC, Sahal, ZAAD, eDahab, Jeeb)
- π‘οΈ **TypeScript support** with complete type definitions
- π **CLI tool** for command-line usage
- π¦ **Batch processing** for multiple numbers
- π― **Beautiful error handling** with detailed messages
- β‘ **Zero dependencies** and lightweight
## π¦ Installation
### For Library Use
```bash
npm install sophone
```
### For CLI Use (Global)
```bash
npm install -g sophone
```
## π Quick Start
### Basic Usage
```javascript
import {
isValidSomaliMobile,
normalizeE164,
formatLocal,
getOperator,
getWallet,
getWalletInfo,
} from "sophone";
// Validate any Somali phone number format
isValidSomaliMobile("+252 61 123 4567"); // β
true
isValidSomaliMobile("0611234567"); // β
true
isValidSomaliMobile("611234567"); // β
true
isValidSomaliMobile("252611234567"); // β
true
isValidSomaliMobile("invalid"); // β false
// Convert to international E.164 format
normalizeE164("0611234567"); // "+252611234567"
// Format for local display
formatLocal("+252611234567"); // "0611 234 567"
// Identify the mobile operator
getOperator("0611234567"); // "Hormuud"
// Identify the mobile wallet
getWallet("0611234567"); // "EVC"
getWallet("0621234567"); // "Sahal"
getWallet("0631234567"); // "ZAAD"
// Get detailed wallet information
const walletInfo = getWalletInfo("0611234567");
console.log(walletInfo.name); // "EVC Plus"
console.log(walletI β¦