1.1.0 • Published 6 years ago

@apolitical/geography v1.1.0

Weekly downloads
68
License
MIT
Repository
github
Last release
6 years ago

geography

Geographical definitions used by Apolitical services. Currently provides lookup functions from regions to a list of countries in that region.

Usage

const {
  regions,
  countriesInRegion,
  countryCodesInRegion,
  countryNamesInRegion,
} = require('@apolitical/geography');

OR

import {
  regions,
  countriesInRegion,
  countryCodesInRegion,
  countryNamesInRegion,
} from '@apolitical/geography';


regions() // Get a list of region codes

regionName('afr', 'en-GB') // The name of the afr region in UK English (i.e. Africa)

countryNamesInRegion('afr') // Country names in Africa
countryCodesInRegion('eur') // Country code in Europe
countriesInRegion('na') // Code->name map for North America

For full browser support (including IE 10 & 11), you will need to use babel-polyfill in your application.

Regions

The region codes correspond to:

codename
afrAfrica
casCentral Asia
eapEast Asia & Pacific
eurEurope
lacLatin America & Caribbean
menaMiddle East & North Africa
naNorth America
ocOceania
sarSouth Asia

These are based on regions defined by the World Bank, except that we include Oceania, North America, and split out Europe and Central Asia.