2017-07-14 19:30:12 +01:00
|
|
|
// @preval
|
|
|
|
// Force tree shaking on emojione by exposing just a subset of its functionality
|
|
|
|
|
|
|
|
const emojione = require('emojione');
|
|
|
|
|
|
|
|
const mappedUnicode = emojione.mapUnicodeToShort();
|
2017-08-02 20:05:17 +01:00
|
|
|
const excluded = ['®', '©', '™'];
|
2017-07-14 19:30:12 +01:00
|
|
|
|
2017-07-18 21:49:24 +01:00
|
|
|
module.exports.unicodeMapping = Object.keys(emojione.jsEscapeMap)
|
2017-08-02 20:05:17 +01:00
|
|
|
.filter(c => !excluded.includes(c))
|
2017-07-14 19:30:12 +01:00
|
|
|
.map(unicodeStr => [unicodeStr, mappedUnicode[emojione.jsEscapeMap[unicodeStr]]])
|
2017-09-23 00:41:00 +01:00
|
|
|
.map(([unicodeStr, shortCode]) => ({ [unicodeStr]: [emojione.emojioneList[shortCode].fname.replace(/^0+/g, ''), shortCode.slice(1, shortCode.length - 1)] }))
|
2017-07-14 19:30:12 +01:00
|
|
|
.reduce((x, y) => Object.assign(x, y), { });
|