return emoji flag symbol for country code
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig Initial commit Apr 14, 2015
.gitignore Initial commit Apr 14, 2015
.jshintrc Initial commit Apr 14, 2015
.travis.yml Initial commit Apr 14, 2015
cli.js Create CLI Apr 14, 2015
data.json Add EU flag πŸ‡ͺπŸ‡Ί (#1) Jul 19, 2016
index.js Create index.js Apr 14, 2015
license Initial commit Apr 14, 2015
package.json 1.2.0 Jul 19, 2016
readme.md Revert "Add screenshot to readme.md" Apr 14, 2015
test.js Add EU flag πŸ‡ͺπŸ‡Ί (#1) Jul 19, 2016

readme.md

emoji-flags Build Status Dependency Status

return emoji flag symbol for country code

Install

$ npm install --save emoji-flags

Usage

var emojiFlags = require('emoji-flags');

// single country lookup by code
emojiFlags.countryCode('DK');
// => { "code": "DK", "emoji": "πŸ‡©πŸ‡°", ... }

// entire dataset
emojiFlags.data;

CLI

$ npm install --global emoji-flags
$ emoji-flags --help

  return emoji flag symbol for country code

  Example
    emoji-flags gb

    emoji-flags dk --verbose

    emoji-flags
    => returns the entire dataset

API

countryCode

Option

Type: String
Default: undefined

Takes an ISO 3166-1 alpha-2 code, and returns country details:

{
    "code": "DK",
    "emoji": "πŸ‡©πŸ‡°",
    "unicode": "U+1F1E9 U+1F1F0",
    "name": "Denmark",
    "title": "flag for Denmark"
}

Getters

The module exposes a bunch of simple getter methods:

  • data - returns the entire dataset
  • emojis - returns an array of all emojis
  • codes - returns an array of all country codes
  • names - returns an array of all country names
  • unicodes - returns an array of all emojis reprensented as unicode

Getter methods for all country codes:

emojiFlags.GB;
// => {
//      "code": "GB",
//      "emoji": "πŸ‡¬πŸ‡§",
//      "unicode": "U+1F1EC U+1F1E7",
//      "name": "United Kingdom",
//      "title": "flag for United Kingdom"
//    }

License

MIT Β© Matias Singers