Country Flag Emoji
List of country codes and its flag emojis.
Installation
$ npm install country-flag-emoji
CDN
The library is available over a CDN:
<!-- Or the minified version -->
Usage
; // All country flag emojis keyed by country codeconsole; // Array of all country flag emojisconsole; // Array of country codesconsole; // Get country flag emoji for the given country codeconsole;// US: {// code: "US",// unicode: "U+1F1FA U+1F1F8",// name: "United States",// emoji: "🇺🇸"// }
API
data
Property
Get all country flag emojis keyed by country code.
countryFlagEmojidata
Data format:
//... ID: code: "ID" unicode: "U+1F1EE U+1F1E9" name: "Indonesia" emoji: "🇮🇩" IE: code: "IE" unicode: "U+1F1EE U+1F1EA" name: "Ireland" emoji: "🇮🇪" //...
list
Property
Get all country flag emojis.
countryFlagEmojilist
Data format:
//... code: "ID" unicode: "U+1F1EE U+1F1E9" name: "Indonesia" emoji: "🇮🇩" code: "IE" unicode: "U+1F1EE U+1F1EA" name: "Ireland" emoji: "🇮🇪" //...
countryCodes
Property
Get all country codes.
countryFlagEmojicountryCodes
Data format:
... "IC" "ID" "IE" ...
get()
Method
countryFlagEmoji
Parameters
countryCode
(optionalString
): Two-letter country code in ISO 3166-1 alpha-2 format.
Returns
There are three possible return types:
Array
: If nocountryCode
being passed, it returns array of all country flag emojis.undefined
: If the given country code is not found.Object
: If the emoji is found for the given country code. The returned object has 4 properties:code
: The two-letter country code in ISO 3166-1 alpha-2 format.unicode
: Flag emoji Unicode character sequence, e.g.U+1F1EE U+1F1E9
. Read more about Regional Indicator Symbol.name
: The country name.emoji
: The country flag emoji.
Related
- country-flag-emoji-json: Country flag emojis in JSON format.