Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
utils.getBaseImages(conf.BASE_SIZE).forEach(image => {
const basename = path.basename(image, '.png');
const emojiKey = basename.split('-').map(code => {
if (code.length < UNICODE_LENGTH) {
return `${'0'.repeat(UNICODE_LENGTH - code.length)}${code}`;
}
return code;
}).join('-');
const data = emojifile.data[emojiKey];
if (!data) {
console.log(`skipping ${basename}...`);
return undefined;
}
data[3].forEach(name => {
if (names[name]) {
throw Error(`Duplicate emoji name: ${name}`);
}
const dist = `${conf.NAME_DIR}/${name}.js`;
const output = `
module.exports = require('${conf.IMG_DIR}/${image}');
`;
console.log(`Generating ${dist}...`);
fs.writeFileSync(dist, output);
});
return undefined;