country-code-lookup

Finds countries by various country codes

country-code-lookup downloads country-code-lookup version country-code-lookup license

country-code-lookupSimilar Packages:

Npm Package Weekly Downloads Trend

3 Years
🌟 Show real-time usage chart on country-code-lookup's README.md, just copy the code below.
## Usage Trend
[![Usage Trend of country-code-lookup](https://npm-compare.com/img/npm-trend/THREE_YEARS/country-code-lookup.png)](https://npm-compare.com/country-code-lookup#timeRange=THREE_YEARS)

Cumulative GitHub Star Trend

🌟 Show GitHub stars trend chart on country-code-lookup's README.md, just copy the code below.
## GitHub Stars Trend
[![GitHub Stars Trend of country-code-lookup](https://npm-compare.com/img/github-trend/country-code-lookup.png)](https://npm-compare.com/country-code-lookup)

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
country-code-lookup08761.4 kB514 days agoMIT

README for country-code-lookup

NPM version Downloads

Country Code Lookup

A node.js module to look up countries by various country codes.

Supported codes:

  • FIPS 10-4 codes (2 digits)
  • ISO 3166 (2 digits)
  • ISO 3166 (3 digits)
  • ISO 3166 (numbers)
  • Internet codes

Installation

$ npm install country-code-lookup

Usage

const lookup = require('country-code-lookup')

// search by FIPS
lookup.byFips('UK')

// search by ISO
lookup.byIso('GB')
lookup.byIso('GBR')
lookup.byIso(826)

// search by internet code
lookup.byInternet('UK')

// search by country name
lookup.byCountry('United Kingdom')

// get an array of all countries
lookup.countries

Searching for a country will return either null, or a country object:

{ continent: 'Europe',
  region: 'Western Europe',
  country: 'United Kingdom',
  capital: 'London',
  fips: 'UK',
  iso2: 'GB',
  iso3: 'GBR',
  isoNo: '826',
  internet: 'UK' }

Useful Links

ISO 2 and 3 digit country codes: https://www.iban.com/country-codes

License

MIT