UNPKG

to-emoji

Version:

A lightweight package to easily convert strings to emojis, and vice-versa.

63 lines (55 loc) 1.25 kB
# to-emoji A lightweight package to easily convert strings to emojis, and vice-versa. ## Installation ```sh-session npm install to-emoji ``` ## Functions ### emojify() ```js const emoji = require("to-emoji") emoji.emojify("hello world") //returns 🇭 🇪 🇱 🇱 🇴 🇼 🇴 🇷 🇱 🇩 ``` ### deemojify() ```js const emoji = require("to-emoji") emoji.deemojify("🇭 🇪 🇱 🇱 🇴 🇼 🇴 🇷 🇱 🇩") //returns "hello world" ``` ### emoticonToEmoji() ```js const emoji = require("to-emoji") emoji.emoticonToEmoji(":) ;) :')") //returns "🙂 😉 😂" ``` ### emojiToEmoticon() ```js const emoji = require("to-emoji") emoji.emojiToEmoticon("🙂 😉 😂") //returns ":) ;) :')" ``` ## Resources ### Emoji Conversion List *Uses the same as Discord's "convert emoticons to emojis" setting.* | Emoticon | Emoji | :--- | :--- :) | 🙂 ;) | 😉 :D | 😄 :O | 😮 :\| | 😐 :,( | 😢 :'( | 😢 \>:( | 😠 :P | 😛 ,:) | 😅 :$ | 😒 :@ | 😡 <3 | ❤️ :( | 😦 :') | 😂 :,) | 😂 ,:( | 😓 ### Notice There is a space between each emojified character, and 2 spaces per space inputted (you can adjust this using `.replace()` if needed, but generally it's optimized; especially for Discord bots).