1.0.2 • Published 5 years ago
ugandan-numbers v1.0.2
Ugandan Phone Number
A minimalist package for validating Ugandan phone numbers using Regular Expressions
Installation
$ npm install ugandan-numbers --saveor
yarn add ugandan-numbersUsage
The module assumes that you input field that you will prepend a    +256 and you should therefore not expect users to type that. This implies that your UI should look like so: 
     |***********************|
+256 |  Enter phone number   |
     |***********************|Here is the implementation:
const ugandanNumber = require('ugandan-numbers');
let phoneNumberField = document.querySelector('#phone-input').value;
ugandanNumber.isValid(phoneInput);  //returns true or falseMore to the above
//  10 digits
ugandanNumber.isValid('0781254565'); // true
// pass argument as Number
ugandanNumber.isValid(0781254565); // true
// Unknown provider
ugandanNumber.isValid(0281254565); // falseInspiration
This package has been made after an inspiration from Udokah's Naija PhoneNumber
Reporting bugs
You can create a new issue for a abug that you noticed here Report issue
Licence
MIT