All Projects → thekelvinliu → Country Code Emoji

thekelvinliu / Country Code Emoji

Licence: mit
convert country codes (ISO 3166-1 alpha-2) to corresponding emoji flags (unicode regional indicator symbols)

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Country Code Emoji

Emojikeyboard
自定义表情键盘(支持系统表情, 图片表情),仅供参考学习~
Stars: ✭ 33 (-49.23%)
Mutual labels:  emoji
Emotecollector
Collects emotes from other servers for use by people who don't have Nitro
Stars: ✭ 51 (-21.54%)
Mutual labels:  emoji
Unicode Proposals
Proposals for new characters to encode and canonic character sequences to register
Stars: ✭ 55 (-15.38%)
Mutual labels:  emoji
Emotion Ratings
😠 😞 😑 😊 😍 This plugin allows you to create ratings using emojis
Stars: ✭ 37 (-43.08%)
Mutual labels:  emoji
Twemoji Color Font
Twitter Unicode 13 emoji color OpenType-SVG font for Linux/MacOS/Windows
Stars: ✭ 1,006 (+1447.69%)
Mutual labels:  emoji
Code Review Emoji Guide
An emoji legend to help convey intention and added meaning in code review comments.
Stars: ✭ 52 (-20%)
Mutual labels:  emoji
Node Emoji
😏 simple emoji support for node.js projects
Stars: ✭ 958 (+1373.85%)
Mutual labels:  emoji
Normalize country
Convert country names and codes to a standard.
Stars: ✭ 60 (-7.69%)
Mutual labels:  emoji
Superbadges
Emoji Tab Bar button badges ✨
Stars: ✭ 47 (-27.69%)
Mutual labels:  emoji
Awesome Emoji Picker
Add-on/WebExtension that provides a modern emoji picker that you can use to find and copy/insert emoji into the active web page.
Stars: ✭ 54 (-16.92%)
Mutual labels:  emoji
Unicode Tr51
Emoji data extracted from Unicode Technical Report #51.
Stars: ✭ 38 (-41.54%)
Mutual labels:  emoji
Fliplog
fluent logging with verbose insight, colors, tables, emoji, filtering, spinners, progress bars, timestamps, capturing, stack traces, tracking, presets, & more...
Stars: ✭ 41 (-36.92%)
Mutual labels:  emoji
Weird Json
A collection of strange encoded JSONs. For connoisseurs.
Stars: ✭ 53 (-18.46%)
Mutual labels:  emoji
Polarity
Detect the polarity (sentiment) of text
Stars: ✭ 33 (-49.23%)
Mutual labels:  emoji
Gitmoji Commit Hook
Start the commit message with an applicable emoji
Stars: ✭ 58 (-10.77%)
Mutual labels:  emoji
Alfred Kaomoji
Alfred workflow to find relevant Kaomoji from text
Stars: ✭ 33 (-49.23%)
Mutual labels:  emoji
Emojitaco
Alfred Emoji Script with Taco and other unicode 9 emoji
Stars: ✭ 51 (-21.54%)
Mutual labels:  emoji
Emoji Regex
A regular expression to match all Emoji-only symbols as per the Unicode Standard.
Stars: ✭ 1,134 (+1644.62%)
Mutual labels:  emoji
Mojilist
🛍 Create shopping lists with emojis!
Stars: ✭ 60 (-7.69%)
Mutual labels:  emoji
Emoji Art Generator
Use a genetic algorithm to evolve an image by putting emojies on a canvas
Stars: ✭ 53 (-18.46%)
Mutual labels:  emoji

country-code-emoji

convert country codes (ISO 3166-1 alpha-2) to corresponding emoji flags (unicode regional indicator symbols)

about

this is a completely dependency-free module to convert ascii letters to regional indicator symbols; for valid country codes, this results in that country's emoji flag. commonjs and es module builds are available via package.json's main and module. it relies on String.fromCodePoint internally, but does not provide any polyfills. if your environment does not support String.fromCodePoint, grab a polyfill like this one from mdn.

install

# npm
npm install country-code-emoji

# yarn
yarn add country-code-emoji

usage

// commonjs module
const { countryCodeEmoji, emojiCountryCode } = require('country-code-emoji');
countryCodeEmoji('US'); // returns '🇺🇸'
emojiCountryCode('🇺🇸'); // returns 'US'

// es module
import { countryCodeEmoji, emojiCountryCode } from 'country-code-emoji';
['AE', 'CN', 'GB'].map(countryCodeEmoji); // returns ['🇦🇪', '🇨🇳', '🇬🇧']
['🇦🇪', '🇨🇳', '🇬🇧'].map(emojiCountryCode); // returns ['AE', 'CN', 'GB']

this module exports a pair of functions to convert country codes to/from flag emojis. the first is countryCodeEmoji(cc). it accepts a two-character (case-insensitive) country code and throws a TypeError if anything else is passed. more specifically, cc is expected to be a ISO 3166-1 alpha-2 country code. to keep things simple, if cc a two letter string, but not an actual ISO 3166-1 alpha-2 code, the regional indicator symbols corresponding to the letters in cc are returned. the second is emojiCountryCode(flag), which accepts a flag emoji and similarly throws a TypeError if anything else is passed.

// default export is countryCodeEmoji
import flag from 'country-code-emoji';

flag(); // throws TypeError
['Us', 'uS', 'us'].every(e => flag(e) === flag('US')); // returns true
flag('UK'); // returns '🇺🇰'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].