about summary refs log tree commit diff
path: root/app/javascript/mastodon/emojione_light.js
blob: 0d07d012f05d9fe309373340ec3f9e8b775a6e1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// @preval
// Force tree shaking on emojione by exposing just a subset of its functionality

const emojione = require('emojione');

const mappedUnicode = emojione.mapUnicodeToShort();
const excluded = ['®', '©', '™'];

module.exports.unicodeMapping = Object.keys(emojione.jsEscapeMap)
  .filter(c => !excluded.includes(c))
  .map(unicodeStr => [unicodeStr, mappedUnicode[emojione.jsEscapeMap[unicodeStr]]])
  .map(([unicodeStr, shortCode]) => ({ [unicodeStr]: [emojione.emojioneList[shortCode].fname, shortCode.slice(1, shortCode.length - 1)] }))
  .reduce((x, y) => Object.assign(x, y), { });