-
Notifications
You must be signed in to change notification settings - Fork 431
Installation & Usage
Dmytro edited this page Jan 31, 2020
·
1 revision
Package is available via:
-
NPM
npm install countries-list
-
Composer / Packagist
composer require annexare/countries-list
-
Bower
bower install countries
Module exports continents
, countries
, languages
, languagesAll
and functions:
-
getEmojiFlag(countryCode)
, wherecountryCode
is alpha-2String
-
getUnicode(emoji)
, whereemoji
is alpha-2 emoji flagString
Built files are in the ./dist
directory.
The ./data
directory contains source data.
The consistent data is available from ./dist/data.*
files (JSON, SQL).
Note: ES5 UMD build is here: ./dist/index.es5.min.js
.
Note: Country item languages
field is an Array
in JSON files to easily count and match items with a Language item.
But currency
and phone
calling codes may be a comma-separated String
.
Note: Languages list only contains languages used in Countries data. Full list of known languages is exported as languagesAll
from ./dist/languages.all.json
.
{
"continents": {
"AF": "Africa",
"AN": "Antarctica",
"AS": "Asia",
"EU": "Europe",
"NA": "North America",
"OC": "Oceania",
"SA": "South America"
},
"countries": {
"AE": {
"name": "United Arab Emirates",
"native": "دولة الإمارات العربية المتحدة",
"phone": "971",
"continent": "AS",
"capital": "Abu Dhabi",
"currency": "AED",
"languages": [
"ar"
],
"emoji": "🇦🇪",
"emojiU": "U+1F1E6 U+1F1EA"
},
...
"UA": {
"name": "Ukraine",
"native": "Україна",
"phone": "380",
"continent": "EU",
"capital": "Kyiv",
"currency": "UAH",
"languages": [
"uk"
],
"emoji": "🇺🇦",
"emojiU": "U+1F1FA U+1F1E6"
}
},
"languages": {
"ar": {
"name": "Arabic",
"native": "العربية",
"rtl": 1
},
...
"uk": {
"name": "Ukrainian",
"native": "Українська"
}
}
}