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.

25 rivejä
739 B

  1. const fs = require('fs');
  2. const path = require('path');
  3. // Get emoji data from https://github.com/milesj/emojibase
  4. // https://github.com/milesj/emojibase/blob/master/packages/data/en/data.json
  5. function generate() {
  6. const map = Object.create(null);
  7. const emojis = require(path.join(process.cwd(), 'data.json'));
  8. for (const emoji of emojis) {
  9. if (emoji.shortcodes == null || emoji.shortcodes.length === 0) continue;
  10. for (const code of emoji.shortcodes) {
  11. if (map[code] !== undefined) {
  12. console.warn(code);
  13. }
  14. map[code] = emoji.emoji;
  15. }
  16. }
  17. fs.writeFileSync(path.join(process.cwd(), 'emojis.json'), JSON.stringify(map), 'utf8');
  18. }
  19. generate();