This code is not currently maintained. Feel free to fork away!
Converts emoji in a string into textual descriptions.
var emojiText = require("emoji-text");
emojiText.convert("🐱🐶"); // "[cat][dog]"
emojiText.convert("🐔 🌵", {
delimiter: ':'
}); // ":chicken: :cactus:"
emojiText.convert("👻 🐴", {
callback: function(emoji,data) {
return "%" + data.description.toLowerCase() + "%";
}
}); // "%ghost% %horse face%"
emojiText.convert(str, options);
The string to convert, expected to have emoji encoded as UTF-8.
{
before: '[', // character to use before field
after: ']', // character to use after field
delimiter: ':', // shortcut to set before + after to same char
field: 'name', // field to use name, description or emoji,
callback: function(emoji, data) {} // custom conversion callback
}
The data object comes from wemoji and looks like this:
{ emoji: '🏩',
platforms: [ 'tw', 'a', 'g' ],
description: 'LOVE HOTEL',
name: 'love_hotel',
css: 'love_hotel',
category: 'travel' }
Install with npm:
npm install emoji-text
ISC