Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const content = fs.readFileSync(path.join(svgFilesPath, svgFile));
const svgPathMatches = svgPathRegex.exec(content);
const svgPath = svgPathMatches && svgPathMatches[1];
// skip on empty svgPath
if (!svgPath) throw new Error('Empty SVG path');
const icon = {
name: name,
aliases: [],
fileName: name + '.js',
defFileName: name + '.d.ts',
svgPath
};
const iconMeta = meta.find(entry => entry.name === origName);
if (iconMeta) {
icon.aliases = iconMeta.aliases;
}
icons.push(icon);
}
const aliases = [];
const removeAliases = [];
for (const icon of icons) {
for (const alias of icon.aliases) {
const normalizedAlias = normalizeName(alias);
// if the alias starts with a number, ignore it since JavaScript
// doesn't support variable names starting with a number
if (startsWithNumberRegex.test(normalizedAlias)) {
require('../../meta/_community.json').icons.forEach(d => {
const f = meta.find(m => d.name === m.name) || {}
const m = {
author: d.user.name,
aliases: d.aliases,
tags: f.tags
}
data.push({
source: 'Community',
author: m.author,
name: d.name.replace(/[-_]/g, ' '),
aliases: m.aliases && m.aliases.length ? m.aliases : undefined,
tags: m.tags && m.tags.length ? m.tags : undefined,
version: f.version || '?',
data: d.data
})
source(answers, input) {
return input
? Promise.resolve(fuse.search(input))
: Promise.resolve(icons.map(icon => icon.name));
},
searchable: true