all-countries
An API for getting info about countries
You may install this package with this command:
npm install all-countries --save
Once the package has been installed, it can be required inside your code with this line of JavaScript:
var allCountries = ;
Variables and Functions
There are a number of members available. They are as follows:
allCountries.all
Type: 'Variable'
Returns: Array
This returns all countries as an array of strings.
Example:
var allCountries = ; console; // [ '...']
allCountries.getCountryByCode
Type: 'Function'
Parameter: 'code'
Returns: String
This returns country name as a string based on the passed in ISO2 country code.
Example:
var allCountries = ; console; // United States
allCountries.getCountryByCapital
Type: 'Function'
Parameter: 'capital'
Returns: String
This returns country name as a string based on the passed in country capital.
Example:
var allCountries = ; console; // United States
allCountries.getCountryByPhoneCode
Type: 'Function'
Parameter: 'phoneCode'
Returns: String
This returns country name as a string based on the passed in country phone code.
Example:
var allCountries = ; console; // United States
allCountries.getCountryCodes
Type: 'Function'
Returns: Array
This returns all ISO2 country codes as an array of strings.
Example:
var allCountries = ; console; // [ '...']
allCountries.getCountryCodeByCountryName
Type: 'Function'
Parameter: 'phoneCode'
Returns: String
This returns country code as a string based on the passed in country name.
Example:
var allCountries = ; console; // US
allCountries.getCapitals
Type: 'Variable'
Returns: Array
This returns all country capitals as an array of strings.
Example:
var allCountries = ; console; // [ '...']
allCountries.getCapitalByCountryCode
Type: 'Function'
Parameter: 'code'
Returns: String
This returns a country capital as a string based on the passed in ISO2 country code.
Example:
var allCountries = ; console; // Washington
allCountries.getCurrencies
Type: 'Variable'
Returns: Array
This returns all country currency codes as an array of strings.
Example:
var allCountries = ; console; // [ '...']
allCountries.getCurrencyByCountryCode
Type: 'Function'
Parameter: 'code'
Returns: String
This returns a country currency code as a string based on the passed in ISO2 country code.
Example:
var allCountries = ; console; // USD
allCountries.getPhoneCodes
Type: 'Variable'
Returns: Array
This returns all phone codes as an array of strings.
Example:
var allCountries = ; console; // [ '...']
allCountries.getPhoneCodeByCountryCode
Type: 'Function'
Parameter: 'code'
Returns: String
This returns a country phone code as a string based on the passed in ISO2 country code.
Example:
var allCountries = ; console; // 1