phone_number_prefixes
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Phone Number Prefixes and Network

A package that returns the phone number prefixes and networks.

Table of content

Installation

This package can be installed with npm or yarn.

Using npm,

npm install phone_number_prefixes

Using yarn,

yarn add phone_number_prefixes

Usage

const { getNetworks, validatePhoneNumber } = require('phone_number_prefixes'); // JavaScript
import { getNetworks, validatePhoneNumber } from 'phone_number_prefixes'; // Typescript
- Get All Networks name and phone number prefixes
const networks = getNetworks();
console.log(networks);
//[
//            {
//                "prefix": "0701",
//                "name": "AIRTEL",
//                "logo": ""
//            },
//            {
//                "prefix": "07020",
//                "name": "SMILE",
//                "logo": ""
//            },
//            {
//                "prefix": "07025",
//                "name": "MTN",
//                "logo": ""
//            }]

- Validate a Phone number
const number_data = validatePhoneNumber('08078197526');
console.log(number_data);
//  {
//            "network": "GLO",
//            "isValid": true
//        }

Available Methods exposed by the Package

The following methods are available with this package

  • getNetworks()
  • validatePhoneNumber()

Want to contribute?

Contributions are welcome! Kindly refer to the contribution guidelines

Readme

Keywords

none

Package Sidebar

Install

npm i phone_number_prefixes

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

12.3 kB

Total Files

14

Last publish

Collaborators

  • ridbay