Skip to content

ktalebian/mcc-mnc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcc-mnc

A wrapper for mcc-mnc lookup.

JSON source file

The source file is taken from musalbas's mcc-mnc-table repo.

Installation

Install the package using npm install mcc-mnc.

Usage

After installation, include it and instantiate it to use it:

var MccMnc = require('mcc-mnc');
var mccMnc = new MccMnc();

Available methods are:

  • mcc(int) Filter by mcc
  • mnc(int) Filter by mnc
  • country(string) Filter by country
  • network(string) Filter by network
  • countryCode(string) Filter by country_code
  • get() Returns all the matched filters
  • clear() Clears the search filter.

Examples

Example 1:

const MccMnc = require('mcc-mnc');
const mccMnc = new MccMnc();

const match = mccMnc.mcc(310).mnc(330).get();
console.log(match);

Returns:

{ 
  network: 'T-Mobile',
  country: 'United States',
  mcc: '310',
  iso: 'us',
  country_code: '1',
  mnc: '330' 
}

Example 2:

const MccMnc = require('mcc-mnc');
const mccMnc = new MccMnc();

const match = mccMnc.mnc(330).get();
console.log(match);

Returns:

[ 
  { network: 'Claro/ CTI/AMX',
    country: 'Argentina Republic',
    mcc: '722',
    iso: 'ar',
    country_code: '54',
    mnc: '330' },
  { network: 'Michigan Wireless LLC',
    country: 'United States',
    mcc: '311',
    iso: 'us',
    country_code: '1',
    mnc: '330' },
  { network: 'T-Mobile',
    country: 'United States',
    mcc: '310',
    iso: 'us',
    country_code: '1',
    mnc: '330' } 
]

If no match is found, -1 is returned.

About

A wrapper for mcc-mnc lookup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published