Logo Lanfrica

eyobsamuel/et-phone

Domain:

digital infrastructure

Record type:

software
Creator:
eyo
Host:
A phone number validation function for Ethiopian Ethio-telecom and Safaricom numbers. et-phone Ethiopian phone number digit validation (incl. Safaricom Ethiopia phone) ## Installing ### Package manager Using npm: ```bash $ npm install et-phone ``` Using yarn: ```bash $ yarn add et-phone ``` Once the package is installed, you can import the library using `import` or `require` approach: ```js import etPhone from 'et-phone'; ``` [Since the function is exported using default export, you can use any name instead of 'etPhone' as the name for the imported function.] ## Examples The default validation will include mobile and fixed-line/ landline phone numbers for Ethio-telecom and Safaricom-Ethiopia. ```js etPhone("0911 23 45 67") // { isValid: true, phoneNumber: "+251911234567", provider: "Ethio telecom", phoneType: "Mobile" } ``` ```js etPhone("0711 23 45 67") // { isValid: true, phoneNumber: "+251711234567", provider: "Safaricom", phoneType: "Mobile" } ``` ```js etPhone("+251 911 23 45 67") // { isValid: true, phoneNumber: "+251911234567", provider: "Ethio telecom", phoneType: "Mobile" } ``` ```js etPhone("+251 711 23 45 67") // { isValid: true, phoneNumber: "+251711234567", provider: "Safaricom", phoneType: "Mobile" } ``` ```js etPhone("+(251) 911 23 45 67") // { isValid: true, phoneNumber: "+251911234567", provider: "Ethio telecom", phoneType: "Mobile" } ``` ```js etPhone("+(251) 711 23 45 67") // { isValid: true, phoneNumber: "+251711234567", provider: "Safaricom", phoneType: "Mobile" } ``` ```js etPhone("911234567") // { isValid: true, phoneNumber: "+251711234567", provider: "Ethio telecom", phoneType: "Mobile" } ``` ```js etPhone("711234567") // { isValid: true, phoneNumber: "+251711234567", provider: "Safaricom", phoneType: "Mobile",} ``` ```js etPhone(911234567) // { isValid: true, phoneNumber: "+251711234567", provider: "Ethio telecom", phoneType: "Mobile" } ``` ```js etPhone(711234567) // { isValid: true, phoneNumber: "+251711234567", provider: "Safaricom", phoneType: "Mobile" } ``` You can also specify specific phone number t …

Languages

Licenses