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 regels
739 B

const fs = require('fs');
const path = require('path');
// Get emoji data from https://github.com/milesj/emojibase
// https://github.com/milesj/emojibase/blob/master/packages/data/en/data.json
function generate() {
const map = Object.create(null);
const emojis = require(path.join(process.cwd(), 'data.json'));
for (const emoji of emojis) {
if (emoji.shortcodes == null || emoji.shortcodes.length === 0) continue;
for (const code of emoji.shortcodes) {
if (map[code] !== undefined) {
console.warn(code);
}
map[code] = emoji.emoji;
}
}
fs.writeFileSync(path.join(process.cwd(), 'emojis.json'), JSON.stringify(map), 'utf8');
}
generate();