1.0.3 ā¢ Published 3 years ago
textemoticons.js v1.0.3
emoticons.js
Emoticon text codes to emoticons š± ā¤ļø š. It downloads official Emoji list from Unicode.org
What's new
- Now it uses latest Unicode.org emojis :new:
- Support for Emoji Modifier Sequences :new:
- Added correct length calculation of a text containing Emoji
Install from npm
npm install textemoticons.js
Get Emoji from Emoticon Text Code
const EmoticonsJS = require('textemoticons.js');
var emoji = EmoticonsJS.emoji[ "pool_8_ball" ]
š±
Top Nearest emoji from Text
const EmoticonsJS = require('textemoticons.js');
EmoticonsJS.nearest("button", 10).then(emoji => console.log(emoji) )
[ 'ā¹', 'āø', 'š', 'āŗ', 'š²', 'ā', 'š
', 'š³', 'āÆ', 'ā®' ]
Fuzzy search Emoji from Text
const EmoticonsJS = require('textemoticons.js');
EmoticonsJS.match("cat", 10).then(emoji => console.log(emoji) )
[ 'š¤ ', 'š°', 'š', 'šŗ', 'šø', 'š¹', 'š»', 'š¼', 'š½', 'š' ]
Count length of text containing Emoji :new:
const EmoticonsJS = require('textemoticons.js');
EmoticonsJS.length("Look at " + EmoticonsJS.emoji[ "point_down" ])
9
Download Emoji text file from Unicode.org :new:
// Grab the latest version of Emoji from Unicode.org
EmoticonsJS.download({ version: '13.1' }).
then(emoji => {
console.log(JSON.stringify( emoji, null, 2) );
})
.catch(error => {
console.error(error);
})
Unicode.org Emoji text file
Array of emoji with Unicode point, emoji and description
{
"codes": [
"1F912"
],
"emoji": "š¤",
"description": " fully-qualified # š¤ E1.0 face with thermometer",
"textcode": "face_with_thermometer"
}
It supports multiple codes as well:
{
"codes": [
"1F449",
"1F3FB"
],
"emoji": "šš»",
"description": " fully-qualified # šš» E1.0 backhand index pointing right: light skin tone",
"textcode": "backhand_index_pointing_right:_light_skin_tone"
}