You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
618 B

  1. // @preval
  2. // Force tree shaking on emojione by exposing just a subset of its functionality
  3. const emojione = require('emojione');
  4. const mappedUnicode = emojione.mapUnicodeToShort();
  5. const excluded = ['®', '©', '™'];
  6. module.exports.unicodeMapping = Object.keys(emojione.jsEscapeMap)
  7. .filter(c => !excluded.includes(c))
  8. .map(unicodeStr => [unicodeStr, mappedUnicode[emojione.jsEscapeMap[unicodeStr]]])
  9. .map(([unicodeStr, shortCode]) => ({ [unicodeStr]: [emojione.emojioneList[shortCode].fname.replace(/^0+/g, ''), shortCode.slice(1, shortCode.length - 1)] }))
  10. .reduce((x, y) => Object.assign(x, y), { });