Example
console // United Statesconsole // USAconsole // Estados Unidosconsole // Etats-Unisconsole // アメリカ合衆国console // 美國console // undefinedconsole // USconsole // US
Methods
Usage:
locale is one of ['DE', 'EN', 'ES', 'FR', 'JA', 'PTBR', 'RU', 'ZHCN', 'ZHTW']
getName(code, locale)
Expects a two-digit country code.
Returns the name for that country.
If not found, it returns undefined
.
getCode(name, locale)
Expects the English country name.
Returns the code for that country.
If not found, it returns undefined
.
getPhoneCode(code)
Returns the phone code of a country code.
getNames(locale)
Returns an array of all country names.
getCodes()
Returns an array of all country codes.
getPhoneCodes()
Returns an array of all phone codes.
getNameList(locale)
Returns a key-value object of all countries using the name as key.
getCodeList(locale)
Returns a key-value object of all countries using the code as key.
Install
yarn add freegeoip-country-list
Related Projects
License
MIT