itu-e164-country-codes

1.0.2 • Public • Published

ITU-T E.164 Country Code Lookup

npm version License: MIT CircleCI Coverage Status Known Vulnerabilities

Javascript Module for searching ITU E.164 Country Codes.

Source data:

Installation

npm install itu-e164-country-codes

Usage

fromITUCode

Search for records by ITU E.164 assigned country code.

```javascript
const { fromITUCode } = require('itu-e164-country-codes');

// Search by ITU E.164 Country Code
console.log(fromITUCode(372));
/*
[
  {
    itu_country_code: 372,
    name: 'Estonia (Republic of)',
    iso_country_code: 'EW'
  }
]
 */

NOTE: Many ITU E.164 assigned country codes represent multiple countries or regions. Each region recognised by the ITU is represented as a separate record.

fromISOCode

Search for records by ISO 3166-1 alpha-2 Country Code.

// Search by ISO 3166-1 alpha-2 Country Code
console.log(fromISOCode('AU'));
/*
[
  {
    itu_country_code: 61,
    name: 'Australia',
    iso_country_code: 'AU'
  },
  {
    itu_country_code: 672,
    name: 'Australian External Territories',
    iso_country_code: 'AU'
  }
]
 */

NOTE: Some ITU E.164 assigned country codes correspond to sub-regions of an ISO 3166-1 recognised country which is not separately recognised by the ISO. In these cases these are grouped under the primary ISO-3166-1 code. This means multiple entries may match a single ISO 3166-1 alpha-2 country code.

Data Structure

[
  {
    itu_country_code: number,
    name: string,
    iso_country_code: string
  }
]
Field Type Description Notes
itu_country_code number ITU-T E.164 assigned country code
iso_country_code string | null ISO 3166-1 alpha-2 country code Where the ITU code represents a sub-region of a country which does not have a seperate ISO 3166-1 designation the country designation is used. If the ITU code does not correspond to a country or region of a country this will be null.
name string | null Name Defined as per the ITU document "List of Recommendation ITU-T E.164 assigned country codes". If the ITU-T documentation lists this ITU-T e.164 assigned country code as "Spare" this will be null.

Package Sidebar

Install

npm i itu-e164-country-codes

Weekly Downloads

7

Version

1.0.2

License

MIT

Unpacked Size

35.5 kB

Total Files

6

Last publish

Collaborators

  • tjdavey