2017-10-06 12:42:34 +11: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.
|
2023-05-09 11:08:47 +10:00
|
|
|
import emojiCompressed from './emoji_compressed';
|
2023-05-24 01:15:17 +10:00
|
|
|
import { unicodeToUnifiedName } from './unicode_to_unified_name';
|
2023-05-09 11:08:47 +10:00
|
|
|
|
|
|
|
const [ shortCodesToEmojiData, skins, categories, short_names ] = emojiCompressed;
|
2017-10-06 12:42:34 +11:00
|
|
|
|
|
|
|
const emojis = {};
|
|
|
|
|
|
|
|
// decompress
|
|
|
|
Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
|
|
|
|
let [
|
2023-04-03 11:31:39 +10:00
|
|
|
filenameData, // eslint-disable-line @typescript-eslint/no-unused-vars
|
2017-10-06 12:42:34 +11:00
|
|
|
searchData,
|
|
|
|
] = shortCodesToEmojiData[shortCode];
|
|
|
|
let [
|
|
|
|
native,
|
|
|
|
short_names,
|
|
|
|
search,
|
|
|
|
unified,
|
|
|
|
] = searchData;
|
|
|
|
|
|
|
|
if (!unified) {
|
|
|
|
// unified name can be derived from unicodeToUnifiedName
|
|
|
|
unified = unicodeToUnifiedName(native);
|
|
|
|
}
|
|
|
|
|
|
|
|
short_names = [shortCode].concat(short_names);
|
|
|
|
emojis[shortCode] = {
|
|
|
|
native,
|
|
|
|
search,
|
|
|
|
short_names,
|
|
|
|
unified,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2023-05-09 11:08:47 +10:00
|
|
|
export {
|
2017-10-06 12:42:34 +11:00
|
|
|
emojis,
|
|
|
|
skins,
|
|
|
|
categories,
|
|
|
|
short_names,
|
|
|
|
};
|