JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 427585
  • Score
    100M100P100Q174448F
  • License BSD

Maps ISO 3166-1-alpha-2 codes to English country names and vice versa.

Package Exports

  • country-list
  • country-list/data.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (country-list) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

country-list

Maps ISO 3166-1-alpha-2 codes to English country names and vice versa.

Uses data from http://data.okfn.org/data/country-list

example

var countries = require('country-list')();

console.log(countries.getName('IS')); // Iceland
console.log(countries.getCode('Iceland')); // IS

methods

Usage:

var countries = require('country-list')();

All input is case-insensitive.

getName(code)

Expects a two-digit country code. Returns the name for that country. If not found, it returns undefined.

getCode(name)

Expects the English country name. Returns the code for that country. If not found, it returns undefined.

getNames()

Returns an array of all country names.

getCodes()

Returns an array of all country codes.

install

npm install country-list

license

BSD