Emoji library that contains only the emojis that work on most of the browsers and operating systems currently available :rocket: :earth_africa:
Finally no more ๏ฟฝ symbols when rendering the emojis :partying_face:
Based off emojis from emojilib and keywords from unicode-emoji-json
NB: EmojiSet requires Node version 14 or above.
npm install emoji-set --save
To get started, you can import the package using two methods:
// ES6 import
import EmojiSet from 'emoji-set'
// or CommonJS import
const EmojiSet = require('emoji-set')
get(filter = {})
Returns the emojis that match the given filter. Leave the filter
parameter blank
to return all available emojis.
Available fields for the filter parameter include: |
Field | Default | Description |
---|---|---|---|
only_emoji |
false |
true to only return the emojis, false to return the emojis and their information |
|
by_section |
false |
true to return the emojis grouped by their section, false to return the emojis without any grouping |
|
by_keyword |
false |
true to return the emojis grouped by their keywords, false to return the emojis without any grouping |
Some examples can be seen below.
console.log(EmojiSet.get())
/* Returns */
{
'๐': {
name: 'grinning face',
code: 'grinning_face',
group: 'Smileys & Emotion',
keywords: [ 'grin', 'face', 'smile', 'happy', 'joy', ':D' ]
},
'๐': {
name: 'grinning face with big eyes',
code: 'grinning_face_with_big_eyes',
group: 'Smileys & Emotion',
keywords: [ 'grin', 'face', 'happy', 'joy', 'haha', ':D', ':)', 'smile', 'funny' ]
},
'๐': {
name: 'grinning face with smiling eyes',
code: 'grinning_face_with_smiling_eyes',
group: 'Smileys & Emotion',
keywords: [ 'grin', 'face', 'happy', 'joy', 'funny', 'haha', 'laugh', 'like', ':D', ':)' ]
},
...
}
console.log(EmojiSet.get({ only_emoji: true }))
/* Returns */
[ '๐', '๐', '๐', ... ]
console.log(EmojiSet.get({ by_section: true }))
/* Returns */
{
'Smileys & Emotion': [
{
emoji: '๐',
name: 'grinning face',
code: 'grinning_face',
keywords: [ 'face', 'smile', 'happy', 'joy', ':D', 'grin' ]
},
{
emoji: '๐',
name: 'grinning face with big eyes',
code: 'grinning_face_with_big_eyes',
keywords: [ 'face', 'happy', 'joy', 'haha', ':D', ':)', 'smile', 'funny' ]
},
...
],
'People & Body': [
{
emoji: '๐',
name: 'waving hand',
code: 'waving_hand',
keywords: [ 'hands', 'gesture', 'goodbye', 'solong', 'farewell', 'hello', 'hi', 'palm' ]
},
{
emoji: '๐ค',
name: 'raised back of hand',
code: 'raised_back_of_hand',
keywords: [ 'fingers', 'raised', 'backhand' ]
},
...
],
...
}
console.log(EmojiSet.get({ by_section: true, only_emoji: true }))
/* Returns */
{
'Smileys & Emotion': [ '๐', '๐', ... ],
'People & Body': [ '๐', '๐ค', ... ],
...
}
console.log(EmojiSet.get({ by_keywords: true }))
/* Returns */
{
...
'playful': {
'๐': {
name: 'face with tongue',
code: 'face_with_tongue',
group: 'Smileys & Emotion'
},
'๐': {
name: 'winking face with tongue',
code: 'winking_face_with_tongue',
group: 'Smileys & Emotion'
},
'๐': {
name: 'squinting face with tongue',
code: 'squinting_face_with_tongue',
group: 'Smileys & Emotion'
},
'๐
': {
name: 'tongue',
code: 'tongue',
group: 'People & Body'
}
},
'quiet': {
'๐คซ': {
name: 'shushing face',
code: 'shushing_face',
group: 'Smileys & Emotion'
},
'๐': {
name: 'muted speaker',
code: 'muted_speaker',
group: 'Objects'
},
'๐': {
name: 'bell with slash',
code: 'bell_with_slash',
group: 'Objects'
},
'๐ด': {
name: 'mobile phone off',
code: 'mobile_phone_off',
group: 'Symbols'
}
},
...
}
console.log(EmojiSet.get({ by_keywords: true, only_emoji: true }))
/* Returns */
{
...
'playful': [ '๐', '๐', '๐', '๐
' ],
'quiet': [ '๐คซ', '๐', '๐', '๐ด' ],
...
}
search(filter = {})
Searches for emojis using the given filter.
Available fields for the filter parameter include: |
Field | Default | Description |
---|---|---|---|
only_emoji |
false |
true to only return the emojis, false to return the emojis and their information |
|
by_section |
'' |
Section to return the emojis from. Some examples are: 'Objects' , 'Animals & Nature' etc. Value is case-insensitive |
|
by_keyword |
'' |
Keyword to use in the emoji search. Some examples are: 'smile' , 'tada' etc. Value is case-insensitive |
|
first_match |
false |
true to only return the first match (when using by_keyword ), false to return all matches |
Some examples can be seen below.
console.log(EmojiSet.search({ by_section: 'flags' }))
/* Returns */
[
{
emoji: '๐',
code: 'chequered_flag',
keywords: [ 'chequered', 'flag', 'contest', 'finishline', 'race', 'gokart' ]
},
{
emoji: '๐ฉ',
code: 'triangular_flag',
keywords: [ 'mark', 'milestone', 'place' ]
},
{
emoji: '๐',
code: 'crossed_flags',
keywords: [ 'cross', 'flag', 'japanese', 'nation', 'country', 'border' ]
},
{
emoji: '๐ด',
code: 'black_flag',
keywords: [ 'black', 'flag', 'pirate' ]
},
{
emoji: '๐ณ๏ธ' ,
code: 'white_flag',
keywords: [ 'white', 'flag', 'losing', 'loser', 'lost', 'surrender', 'give up', 'fail' ]
},
{
emoji: '๐ณ๏ธโ๐' ,
code: 'rainbow_flag',
keywords: [ 'rainbow', 'flag', 'pride', 'gay', 'lgbt', 'glbt', 'queer', 'homosexual', 'lesbian', 'bisexual', 'transgender' ]
},
{
emoji: '๐ดโโ ๏ธ',
code: 'pirate_flag',
keywords: [ 'pirate', 'flag', 'skull', 'crossbones', 'banner' ]
}
]
console.log(EmojiSet.search({ by_section: 'flags', only_emoji: true }))
/* Returns */
[ '๐', '๐ฉ', '๐', '๐ด', '๐ณ๏ธ', '๐ณ๏ธโ๐', '๐ดโโ ๏ธ' ]
console.log(EmojiSet.search({ by_keyword: 'perf' }))
/* Returns */
{
'๐ฏ': {
name: 'hundred points',
code: 'hundred_points',
group: 'Smileys & Emotion'
},
'๐': {
name: 'OK hand',
code: 'ok_hand',
group: 'People & Body'
},
'๐ฏ': {
name: 'people with bunny ears',
code: 'people_with_bunny_ears',
group: 'People & Body'
},
'๐คน': {
name: 'person juggling',
code: 'person_juggling',
group: 'People & Body'
}
}
console.log(EmojiSet.search({ by_keyword: 'perf', first_match: true }))
/* Returns */
{
'๐ฏ': {
name: 'hundred points',
code: 'hundred_points',
group: 'Smileys & Emotion'
}
}
console.log(EmojiSet.search({ by_keyword: 'perf', first_match: true, only_emoji: true }))
/* Returns */
[ '๐ฏ' ]