npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

emoji-set

v1.1.0

Published

Emoji library with functions to allow for searching by emoji, group or keyword

Downloads

325

Readme

emoji-set

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

Install :hammer:

NB: EmojiSet requires Node version 14 or above.

npm install emoji-set --save

Usage :cd:

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')

Methods :card_file_box:

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.

:page_with_curl: Get all available emojis

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', ':)' ]
  },
  ...
}

:page_with_curl: Get all available emojis without additional information

console.log(EmojiSet.get({ only_emoji: true }))
/* Returns */
[ '😀', '😃', '😄', ... ]

:page_with_curl: Get emojis grouped by their section name

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' ]
    },
    ...
  ],
  ...
}

:page_with_curl: Get emojis grouped by their section name, without additional information

console.log(EmojiSet.get({ by_section: true, only_emoji: true }))
/* Returns */
{
  'Smileys & Emotion': [ '😀', '😃', ... ],
  'People & Body': [ '👋', '🤚', ... ],
  ...
}

:page_with_curl: Get emojis grouped by their keywords

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'
    }
  },
  ...
}

:page_with_curl: Get emojis grouped by their keywords, without additional information

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.

:page_with_curl: Search for emojis that match the given section name

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' ]
  }
]

:page_with_curl: Search for emojis that match the given section name, without additional information

console.log(EmojiSet.search({ by_section: 'flags', only_emoji: true }))
/* Returns */
[ '🏁', '🚩', '🎌', '🏴', '🏳️', '🏳️‍🌈', '🏴‍☠️' ]

:page_with_curl: Search for emojis that match the given keyword

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'
  }
}

:page_with_curl: Search for emojis that match the given keyword, returning the first match only

console.log(EmojiSet.search({ by_keyword: 'perf', first_match: true }))
/* Returns */
{
  '💯': {
    name: 'hundred points',
    code: 'hundred_points',
    group: 'Smileys & Emotion'
  }
}

:page_with_curl: Search for emojis that match the given keyword, returning the first match only and without any additional information

console.log(EmojiSet.search({ by_keyword: 'perf', first_match: true, only_emoji: true }))
/* Returns */
[ '💯' ]