1.0.3 • Published 6 years ago

@nilestanner/country-list v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

Country info list

Data is sourced from: https://restcountries.eu/rest/v2/all Data is refreshed each night. If there are differences, a new package will be built.

Build at compile time, not at run time

Installation

Install via NPM

npm install country-info-list --save

Include in your project

const countryList = require('country-info-list');
// or
import * as countryList from 'country-info-list';

Usage

getCountries()

Returns all countries with all their data.

getCountry(code)

Returns a country with that code. code can be a 2 or 3 character code.

getNames()

Returns a list of the country names only.

getCodes(?codeType)

Returns a list of the country codes only. codeType is a optional parameter. Valid values: 2, 3. The number indicates how many characters the country code will have. Defaults to 2.

getCode(name, ?codeType)

Returns a country code for a given country name. codeType is a optional parameter. Valid values: 2, 3. The number indicates how many characters the country code will have. Defaults to 2.