ugandan-numbers
v1.0.2
Published
A minimalist package for validating Ugandan phone numbers using Regular Expressions
Downloads
11
Maintainers
Readme
Ugandan Phone Number
A minimalist package for validating Ugandan phone numbers using Regular Expressions
Installation
$ npm install ugandan-numbers --save
or
yarn add ugandan-numbers
Usage
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 false
More to the above
// 10 digits
ugandanNumber.isValid('0781254565'); // true
// pass argument as Number
ugandanNumber.isValid(0781254565); // true
// Unknown provider
ugandanNumber.isValid(0281254565); // false
Inspiration
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