about summary refs log tree commit diff
path: root/app/javascript/mastodon/emoji_data_compressed.js
blob: f69a3e46adeddbceb33cd4be7730f0c293890a03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// @preval
const data = require('emoji-mart/dist/data').default;
const pick = require('lodash/pick');
const values = require('lodash/values');

const condensedEmojis = Object.keys(data.emojis).map(key => {
  if (!data.emojis[key].short_names[0] === key) {
    throw new Error('The condenser expects the first short_code to be the ' +
      'key. It may need to be rewritten if the emoji change such that this ' +
      'is no longer the case.');
  }
  return values(pick(data.emojis[key], ['short_names', 'unified', 'search']));
});

// JSON.parse/stringify is to emulate what @preval is doing and avoid any
// inconsistent behavior in dev mode
module.exports = JSON.parse(JSON.stringify({
  emojis: condensedEmojis,
  skins: data.skins,
  categories: data.categories,
  short_names: data.short_names,
}));