to-emoji

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

Usage no npm install needed!

<script type="module">
  import toEmoji from 'https://cdn.skypack.dev/to-emoji';
</script>

README

to-emoji

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

Installation

npm install to-emoji

Functions

emojify()

const emoji = require("to-emoji")
emoji.emojify("hello world")
//returns 🇭 🇪 🇱 🇱 🇴    🇼 🇴 🇷 🇱 🇩

deemojify()

const emoji = require("to-emoji")
emoji.deemojify("🇭 🇪 🇱 🇱 🇴    🇼 🇴 🇷 🇱 🇩")
//returns "hello world"

emoticonToEmoji()

const emoji = require("to-emoji")
emoji.emoticonToEmoji(":) ;) :')")
//returns "🙂 😉 😂"

emojiToEmoticon()

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).