1.0.4 β€’ Published 6 months ago

easy-emojis v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

easy-emojis

  • Convert country codes (ISO 3166-1) to emoji flags or vice a versa
  • Convert single letters to emojis or vice a versa

This package relies on String.fromCodePoint, and does not provide any polyfills.

install

# npm
npm install easy-emojis

usage

import * as EasyEmojis from 'easy-emojis';
EasyEmojis.countryCodeToFlag('US'); // returns 'πŸ‡ΊπŸ‡Έ'
EasyEmojis.flagToCountryCode('πŸ‡ΊπŸ‡Έ'); // returns 'US'

EasyEmojis.letterToEmoji('S'); // returns 'πŸ‡Έ'
EasyEmojis.emojiToLetter('πŸ‡Έ') // returns 'S'

EasyEmojis.getRandomEmoji(); // should return a random emoji

EasyEmojis.getEmojiByName('red apple'); // should return '🍎'
EasyEmojis.getEmojiByShortName(':apple:'); // should return '🍎'

// getEmoji both accepts name and short name
EasyEmojis.getEmoji('red apple'); // should return '🍎'
EasyEmojis.getEmoji(':apple:'); // should return '🍎'

Run tests

npm run test

1.0.2

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.1

2 years ago

1.0.0

2 years ago