naija-phone-number

    1.0.2 • Public • Published

    npm version Build Status

    Naija Phone Number

    A fast minimal module to validate Nigerian mobile phone numbers using Regular Expressions.

    Installation

    $ npm install naija-phone-number --save
    

    Usage

    This module assumes that you already know that Nigerian numbers are prefixed by +234 and you should not expect your users to type that. Instead your UI should look something like this.

         |**********************|
    +234 |  phone number here   |
         |**********************|
    

    Now that we've gotten this out of the way here's an example

    const naijaNumber = require('naija-phone-number');
     
    let phoneInput = document.querySelector('#phone-input').value;
     
    naijaNumber.isValid(phoneInput); // true or false

    Also

     
    // 12 digit numbers
    naijaNumber.isValid('070328582392'); // true
     
    // pass argument as Number
    naijaNumber.isValid(081928582392); // true
     
    // Unknown provider
    naijaNumber.isValid(050728582392); // false

    License

    MIT

    Install

    npm i naija-phone-number

    DownloadsWeekly Downloads

    21

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • ud