Nightmarish Pawnshop Mystic

    nigerian-phone-number-validator

    1.1.0 • Public • Published

    nigerian-phone-number-validator

    Small utility for validating and sanitizing nigerian phone numbers

    Installation

    $ npm install --save nigerian-phone-number-validator

    Usage

    import { verifyPhoneNumber, sanitizePhoneNumber, COUNTRY_CODE } from "nigerian-phone-number-validator"

    or

    const { verifyPhoneNumber, sanitizePhoneNumber, COUNTRY_CODE } = require("nigerian-phone-number-validator")
    verifyPhoneNumber("2348139922348")); // true
    verifyPhoneNumber("08139922348"));  // true
    
    verifyPhoneNumber("081399223482"); // false
    verifyPhoneNumber("245475693092"); // false
    
    sanitizePhoneNumber("08139922348"); // 2348139922348 (Default Sanitize Mode is throwInvalid)
    sanitizePhoneNumber("08139922348", , { mode : "passthrough" | "throwInvalid" }); // 2348139922348

    Testing

    $ npm test

    Install

    npm i nigerian-phone-number-validator

    DownloadsWeekly Downloads

    9

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    10.4 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar