easy-emojis
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i easy-emojis

Weekly Downloads

30

Version

1.0.4

License

MIT

Unpacked Size

1.77 MB

Total Files

19

Last publish

Collaborators

  • sinansonmez