Author: | emish89 |
---|---|
Views Total: | 19 views |
Official Page: | Go to website |
Last Update: | November 15, 2023 |
License: | MIT |
Preview:

Description:
In the world of digital communication, emojis have become a universal language, adding color and emotion to our texts.
smile2emoji is a simple-to-use JavaScript library that converts text emoticons like :)
, ^^
, :blush:
and even Unicode strings into their corresponding emoji images (😊).
It can scan text for emoticon patterns and replace them with emoji. This can help make conversations and content more visual and expressive.
How to use it:
1. Install the smile2emoji with NPM.
# NPM $ npm i smile2emoji
2. The library exports four easy-to-use functions for converting text, detecting emoji patterns, and more. The main checkText()
function scans a string for any defined emoticon patterns like :)
or ^^
and replaces them with the corresponding emoji.
import { checkText } from 'smile2emoji' // OR from a CDN import { checkText } from "https://cdn.skypack.dev/smile2emoji";
const emoji = checkText(':)');
3. The fromUnicodeToEmoji()
is a specialized function that directly translates Unicode to emojis
import { fromUnicodeToEmoji } from 'smile2emoji' // OR from a CDN import { fromUnicodeToEmoji } from "https://cdn.skypack.dev/smile2emoji";
// ☁️ const emoji = fromUnicodeToEmoji('2601');
4. The checkTextWithAutoSuggestions()
and checkTextWithAutoSuggestionsAndUnicode() functions
detect emoji syntax and replace it with the appropriate emoji even if it’s not an exact match.
import { checkTextWithAutoSuggestions } from 'smile2emoji' import { checkTextWithAutoSuggestionsAndUnicode } from 'smile2emoji' // OR from a CDN import { checkTextWithAutoSuggestions } from "https://cdn.skypack.dev/smile2emoji"; import { checkTextWithAutoSuggestionsAndUnicode } from "https://cdn.skypack.dev/smile2emoji";
// 🎾 emoji = checkTextWithAutoSuggestions(':tenn'); // 🎾 emoji = checkTextWithAutoSuggestionsAndUnicode(':tenn');