bigbuffet-rw/app/soapbox/features/emoji/emoji_mart_data_light.js

36 lines
877 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
// The output of this module is designed to mimic emoji-mart's
// "data" object, such that we can use it for a light version of emoji-mart's
// emojiIndex.search functionality.
const { unicodeToUnifiedName } = require('./unicode_to_unified_name');
const [ shortCodesToEmojiData, skins, categories, short_names ] = require('./emoji_compressed');
const emojis = {};
// decompress
Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
const [
2020-03-27 13:59:38 -07:00
filenameData, // eslint-disable-line no-unused-vars
searchData,
] = shortCodesToEmojiData[shortCode];
const [
2020-03-27 13:59:38 -07:00
native,
short_names,
search,
unified,
] = searchData;
emojis[shortCode] = {
native,
search,
short_names: [shortCode].concat(short_names),
unified: unified || unicodeToUnifiedName(native),
2020-03-27 13:59:38 -07:00
};
});
module.exports = {
emojis,
skins,
categories,
short_names,
};