~cytrogen/masto-fe

ref: a86886b1fdc927ed51810fb6b43a0458bedf1cbb masto-fe/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js -rw-r--r-- 1017 bytes
a86886b1 — alfe Rewrite `<LoadingIndicator/>` as FC and TS (#25364) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 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.
import emojiCompressed from './emoji_compressed';
import { unicodeToUnifiedName } from './unicode_to_unified_name';

const [ shortCodesToEmojiData, skins, categories, short_names ] = emojiCompressed;

const emojis = {};

// decompress
Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
  let [
    filenameData, // eslint-disable-line @typescript-eslint/no-unused-vars
    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,
  };
});

export {
  emojis,
  skins,
  categories,
  short_names,
};