Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('no SVG IDs should be duplicates must be GLOBAL UNIQUE ', function () {
let files = glob.sync(src);
files.forEach(function (file) {
// inventory of all styles in each file
let inventory = {};
inventory.file = file;
let content = fs.readFileSync(file, 'utf8');
let matches = [];
try {
matches = content.match(/id\=\"(.*?)\"/g);
} catch (err) {
}
let trimmed = [];
matches.forEach(function (match) {
trimmed.push(match.replace('.', '').replace('{', ''))
});
await Promise.all(this.funcs.map(async (func) => {
const handler = _.isString(func.handler) ? func.handler.split('.') : [];
const relativePath = handler.slice(0, -1).join('.');
const matchingFiles = glob.sync(`${relativePath}.*`);
if (
matchingFiles.length > 0 &&
(matchingFiles[0].endsWith('.ts') ||
matchingFiles[0].endsWith('.tsx'))
) {
// This is a good enough test for now. lets treat it as TS.
func.language = 'tsnode'; // eslint-disable-line no-param-reassign
}
}));
}
function installDemoStyles() {
log("Writing style files.");
mkdir("demo/styles");
glob.sync("*", {cwd: "./src/styles"}).forEach((file) => {
if (file.endsWith(".css"))
install_cleancss(`./src/styles/${file}`,`demo/styles/${file}`);
else // images, backgrounds, etc
install(`./src/styles/${file}`,`demo/styles/${file}`);
})
}