Logo Lanfrica

Eul45/ethio-helpers

Domaine:

digital infrastructure

Type de record:

tools
Créateur:
Eul
Hôte:
A lightweight JavaScript utility to validate and format Ethiopian mobile phone numbers (Ethio Telecom & Safaricom). # Ethio-Helpers 🇪🇹 A lightweight, zero-dependency utility library for validating and formatting Ethiopian mobile phone numbers. Supports both **Ethio Telecom** and **Safaricom**. --- See it in action: Auto-validation & Formatting --- ## 🚀 Installation ```bash npm install @eyuel_engida/ethio-helpers ``` --- ## 🛠 Usage ### JavaScript ```js const { isEthioPhone, formatEthioPhone } = require('@eyuel_engida/ethio-helpers'); // --- 1. Validation --- // Checks if the number is a valid Ethio Telecom (09) or Safaricom (07) number console.log(isEthioPhone('0911234567')); // true console.log(isEthioPhone('+251712345678')); // true console.log(isEthioPhone('0811234567')); // false (Invalid prefix) console.log(isEthioPhone('0111550000')); // false (Landline) // --- 2. Formatting --- // Converts messy inputs into the standard international format: +251 9XX XXX XXX const formatted = formatEthioPhone('0911223344'); console.log(formatted); // Output: "+251 911 223 344" const formattedSafaricom = formatEthioPhone('0712345678'); console.log(formattedSafaricom); // Output: "+251 712 345 678" ``` --- ## ✨ Features - ✅ **Validation**: Correctly identifies valid `09` (Ethio Telecom) and `07` (Safaricom) prefixes - ✅ **Flexible Input**: Supports numbers with `+251`, `251`, `0`, or no prefix - ✅ **Formatting**: Auto-formats valid numbers into a clean, standardized UI-friendly format - 🪶 **Zero Dependencies**: Fast, lightweight, and dependency-free --- ## 👨‍💻 Author Created by **Eyuel** --- ## 📄 License ISC