country-api

0.0.3 • Public • Published

country-api

  • Promise based api for retrieving country information

Installation / setup

npm install country-api --save

Usage

node

const {CountryApi} = require('country-api')

new CountryApi().byNamePrefix('mex')
.then((data) => console.log(data))

output

[ { name: 'Mexico',
    topLevelDomain: [ '.mx' ],
    alpha2Code: 'MX',
    alpha3Code: 'MEX',
    callingCodes: [ '52' ],
    capital: 'Mexico City',
    altSpellings:
     [ 'MX',
       'Mexicanos',
       'United Mexican States',
       'Estados Unidos Mexicanos' ],
    region: 'Americas',
    subregion: 'Central America',
    population: 122273473,
    latlng: [ 23, -102 ],
    demonym: 'Mexican',
    area: 1964375,
    gini: 47,
    timezones: [ 'UTC-08:00', 'UTC-07:00', 'UTC-06:00' ],
    borders: [ 'BLZ', 'GTM', 'USA' ],
    nativeName: 'México',
    numericCode: '484',
    currencies: [ [Object] ],
    languages: [ [Object] ],
    translations:
     { de: 'Mexiko',
       es: 'México',
       fr: 'Mexique',
       ja: 'メキシコ',
       it: 'Messico',
       br: 'México',
       pt: 'México',
       nl: 'Mexico',
       hr: 'Meksiko',
       fa: 'مکزیک' },
    flag: 'https://restcountries.eu/data/mex.svg',
    regionalBlocs: [ [Object], [Object] ],
    cioc: 'MEX' } ]

API

  • all
  • byNamePrefix
  • byNameFull
  • byCallingCode
  • byCapitalCity
  • byCurrencyCode
  • byIso3166Code
  • byIso3166CodeList
  • byIso6391LanguageCode
  • byRegion
  • byRegionalBlock

Resources

Readme

Keywords

Package Sidebar

Install

npm i country-api

Weekly Downloads

57

Version

0.0.3

License

MIT

Unpacked Size

137 kB

Total Files

11

Last publish

Collaborators

  • javapda