-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
27 lines (21 loc) · 1.06 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* emoticons.js
* Emoticon text codes to emoticons 🎱 ❤️ 🚀
* @copyright Copyright (c) 2019 Loreto Parisi
*/
'use strict'
const EmoticonsJS = require('./lib/index');
// Get Emoji from Emoticon Text Code
console.log(
EmoticonsJS.emoji[ "pool_8_ball" ],
EmoticonsJS.emoji[ "heart_suit" ],
EmoticonsJS.emoji[ "rocket" ]);
// Top Nearest emoji from Text
EmoticonsJS.nearest("button", 10).then(emoji => console.log("button", emoji) )
EmoticonsJS.nearest("woman", 5).then(emoji => console.log("woman", emoji) )
// Fuzzy search Emoji from Text
EmoticonsJS.match("cat", 10).then(emoji => console.log("cat", emoji) )
EmoticonsJS.match("point", 10).then(emoji => console.log("point", emoji) )
// Emoji length
console.log(EmoticonsJS.emoji[ "pool_8_ball" ], " length:", EmoticonsJS.length(EmoticonsJS.emoji[ "pool_8_ball" ]) );
console.log("Look at " + EmoticonsJS.emoji[ "backhand_index_pointing_down" ], " correct length:", EmoticonsJS.length("Look at " + EmoticonsJS.emoji[ "backhand_index_pointing_down" ]), " wrong length:", ("Look at " + "👇").length );