return emoji flag symbol for country code
npm install emoji-flags``sh`
$ npm install --save emoji-flags
`js
var emojiFlags = require('emoji-flags');
// single country lookup by code
emojiFlags.countryCode('DK');
// => { "code": "DK", "emoji": "🇩🇰", ... }
// entire dataset
emojiFlags.data;
`
`sh`
$ npm install --global emoji-flags
`sh
$ emoji-flags --help
return emoji flag symbol for country code
Example
emoji-flags gb
emoji-flags dk --verbose
emoji-flags
=> returns the entire dataset
`
#### Option
Type: String undefined
Default:
Takes an ISO 3166-1 alpha-2 code, and returns country details:
`json`
{
"code": "DK",
"emoji": "🇩🇰",
"unicode": "U+1F1E9 U+1F1F0",
"name": "Denmark",
"title": "flag for Denmark"
}
The module exposes a bunch of simple getter methods:
- data - returns the entire datasetemojis
- - returns an array of all emojiscodes
- - returns an array of all country codesnames
- - returns an array of all country namesunicodes
- - returns an array of all emojis reprensented as unicode
Getter methods for all country codes:
`js``
emojiFlags.GB;
// => {
// "code": "GB",
// "emoji": "🇬🇧",
// "unicode": "U+1F1EC U+1F1E7",
// "name": "United Kingdom",
// "title": "flag for United Kingdom"
// }
MIT © Matias Singers