country-code-lookup
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.352,660latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.352,660
0.1.23,551
0.1.13,734
0.1.06,200
0.0.233,937
0.0.223,103
0.0.2011,006
0.0.1928,299
0.0.181,344
0.0.17352
0.0.16220
0.0.15152
0.0.14429
0.0.13138
0.0.120
0.0.1150
0.0.102
0.0.90
0.0.853
0.0.70
0.0.65
0.0.52
0.0.40
0.0.30
0.0.20
0.0.10
0.0.00

Package Sidebar

Install

npm i country-code-lookup

Weekly Downloads

99,099

Version

0.1.3

License

MIT

Unpacked Size

60.7 kB

Total Files

9

Last publish

Collaborators

  • richard.astbury