Check Validity and Service Providers of Ugandan phone numbers
Use the node package manager npm to install ug-phone.
npm install ug-phone
const ugPhone = require("ug-phone");
import ugPhone from "ug-phone";
ugPhone.isUgandanNumber("0755128879", [bool:validateLandline]);
// returns true
By default, landline numbers are accepted, second argument is optional and true by default
ugPhone.getUgandanProvider("+256755128879", [boolean:acceptLandline]);
// returns Airtel
//
This method returns null if no match is found
By default, landline numbers are accepted, second argument is optional and true by default
- Begins with
2567
or07
or+2567
followed by exactly 8 digits
- Begins with
256
or0
or+256
followed20
or31
or39
followed by exactly 8 digits
- 07712345678
- +256712345678
- 256712345678
- 0202345678
- 256392345678
- +256312345678
- Airtel
- MTN
- Africell
- Uganda Telecom
- LycaMobile
- Smile Telecom
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.