How to use the emojibase.generateEmoticonPermutations function in emojibase

To help you get started, we’ve selected a few emojibase 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 milesj / interweave / packages / emoji / src / EmojiDataManager.ts View on Github external
}

    // Canonicalize the shortcodes for easy reuse
    emoji.canonical_shortcodes = shortcodes.map(code => `:${code}:`);

    // eslint-disable-next-line prefer-destructuring
    emoji.primary_shortcode = emoji.canonical_shortcodes[0];

    // Support all shortcodes
    emoji.canonical_shortcodes.forEach(shortcode => {
      this.SHORTCODE_TO_HEXCODE[shortcode] = hexcode;
    });

    // Support all emoticons
    if (emoticon) {
      generateEmoticonPermutations(emoticon, EMOTICON_OPTIONS[emoticon]).forEach(emo => {
        this.EMOTICON_TO_HEXCODE[emo] = hexcode;
      });
    }

    // Support all presentations (even no variation selectors)
    this.UNICODE_TO_HEXCODE[fromCodepointToUnicode(fromHexcodeToCodepoint(hexcode))] = hexcode;

    if (emoji.emoji) {
      this.UNICODE_TO_HEXCODE[emoji.emoji] = hexcode;
    }

    if (emoji.text) {
      this.UNICODE_TO_HEXCODE[emoji.text] = hexcode;
    }

    // Map each emoji
github milesj / emojibase / packages / generator / src / generators / generateRegex.ts View on Github external
Object.keys(data).forEach(hexcode => {
    const { emoticon } = data[hexcode];

    if (emoticon) {
      emoticons.push(...generateEmoticonPermutations(emoticon, EMOTICON_OPTIONS[emoticon] || {}));
    }
  });