ugandan-numbers

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i ugandan-numbers

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

15.6 kB

Total Files

5

Last publish

Collaborators

  • morelmiles