Country Tools
A simple NodeJS helper for getting information about countries of the world.
Usage
npm install country-tools
;
Data
Data has been downloaded from mledoze/countries.
Included Tools
Get Currency Code from Country ISO2 Code
Returns a country's currency given it's ISO2 code (US
, FI
, etc).
getCurrencyFromIso2countryCode: string: string | null
Sample:
; // USD; // EUR; // null
Get Country Information from Country ISO2 Code
Returns complete information for a given country:
findCountryByIso2countryCode: string: Country | null
Sample:
; // { ...info }; // null
This function returns type Country
which looks like the following:
name: common: "Finland" official: "Republic of Finland" native: fin: Object swe: Object tld: ".fi" cca2: "FI" ccn3: "246" cca3: "FIN" cioc: "FIN" currency: "EUR" callingCode: "358" capital: "Helsinki" altSpellings: "FI" "Suomi" "Republic of Finland" "Suomen tasavalta" "Republiken Finland" region: "Europe" subregion: "Northern Europe" languages: fin: "Finnish" swe: "Swedish" translations: deu: official: "Republik Finnland" common: "Finnland" fra: official: "République de Finlande" common: "Finlande" hrv: official: "Republika Finska" common: "Finska" ita: official: "Repubblica di Finlandia" common: "Finlandia" jpn: official: "フィンランド共和国" common: "フィンランド" nld: official: "Republiek Finland" common: "Finland" por: official: "República da Finlândia" common: "Finlândia" rus: official: "Финляндская Республика" common: "Финляндия" slk: official: "Fínska republika" common: "Fínsko" spa: official: "República de Finlandia" common: "Finlandia" fin: official: "Suomen tasavalta" common: "Suomi" est: official: "Soome Vabariik" common: "Soome" zho: official: "芬兰共和国" common: "芬兰" latlng: 64 26 demonym: "Finnish" landlocked: false borders: "NOR" "SWE" "RUS" area: 338424
License
The code is licensed under the MIT License. See the data's LICENSE file for more information.