Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ug-phone

kaggwa28ISC1.0.4

Determine which service provider a Ugandan phone number belongs to and check validity of Ugandan phone numbers

Phone, Phone Provider, Uganda Phone, Service Provider, Uganda, Phone number, Phone Validation, Network Provider

readme

ug-phone

Check Validity and Service Providers of Ugandan phone numbers

Installation

Use the node package manager npm to install ug-phone.

npm install ug-phone

Usage

Include in your project

ES5

const ugPhone = require("ug-phone");

ES6

import ugPhone from "ug-phone";

Check if phone number is in valid Ugandan format

ugPhone.isUgandanNumber("0755128879");
// returns true

Get network service provider of a given phone number

ugPhone.getUgandanProvider("+256755128879");
// returns Airtel

Valid number criteria

  • Begins with 2567 or 07 or +2567 followed by exactly 8 digits

Valid number examples

  • 07712345678
  • +256712345678
  • 256712345678

Available service providers

  • Airtel
  • MTN
  • Africell
  • Uganda Telecom
  • Lycamobile
  • Smile Telecom

Contributing

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.

License

MIT