Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// 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
Object.keys(data).forEach(hexcode => {
const { emoticon } = data[hexcode];
if (emoticon) {
emoticons.push(...generateEmoticonPermutations(emoticon, EMOTICON_OPTIONS[emoticon] || {}));
}
});