How to use the emoji-mart.NimbleEmojiIndex function in emoji-mart

To help you get started, weโ€™ve selected a few emoji-mart examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / extension-emoji / src / emoji-helpers.ts View on Github external
export const getEmojiDataByEmoticon = (emoticon: string, data: Data) => {
  const emojiIndex = new NimbleEmojiIndex(data);
  let emojiData: BaseEmoji | undefined;
  const emoticonName = Object.keys(emoticonMap).find(name => emoticonMap[name].includes(emoticon));

  if (emoticonName) {
    emojiData = Object.values(emojiIndex.emojis)
      .filter(isBaseEmoji)
      .find(item => item.name === emoticonName);
  }

  return emojiData;
};