Library for working with emojis in TypeScript.
npm install @telegram.ts/emoji
# or
yarn add @telegram.ts/emojiimport {
find,
search,
unemojify,
emojify,
has,
strip,
} from "@telegram.ts/emoji";
// Find an emoji by its name or alias
const foundEmoji = find(":heart:");
console.log(foundEmoji); // Output: { name: 'red heart', alias: ':heart:', slug: '2764', ... }
// Check if a text contains emojis of a specified type
console.log(has("I ❤️ coding with emojis!")); // Output: true
console.log(has("I ❤️ coding with emojis!", "unicode")); // Output: true
console.log(has("I ❤️ coding with emojis!", "emoji")); // Output: true
// Remove emojis from a text based on the specified type
console.log(strip("I ❤️ coding with emojis!")); // Output: "I love coding with emojis!"
console.log(strip("I ❤️ coding with emojis!", "unicode")); // Output: "I love ❤️ coding with emojis!"
console.log(strip("I ❤️ coding with emojis!", "emoji")); // Output: "I ❤️ coding with emojis!"
// Search for emojis in a text and return an array of emoji objects
console.log(search("I ❤️ coding with emojis!")); // Output: [ { name: 'red heart', alias: ':heart:', ... }, ... ]
// Replace emoji codes with their respective Unicode characters
console.log(unemojify(":heart: :smile:")); // Output: "❤️ 😊"
// Replace Unicode characters with their respective emoji codes
console.log(emojify("I ❤️ coding with emojis!")); // Output: "I :heart: coding with :smile:!"This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! If you find any issues or have suggestions for improvements, please create a GitHub issue or submit a pull request. Additionally, feel free to reach out to me on Telegram via my username @SempaiJS or on Discord using my username sempaika_chess.