Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const entries = Object.entries(visitor);
const nodesExclude = maybeArray(options.exclude);
const nodesInclude = maybeArray(options.include);
for (const [tmpl, fn] of entries) {
if (!isTemplate(tmpl)) {
parsed.push(exclude({
rule,
tmpl,
fn,
nodesExclude,
}));
continue;
}
const [node, type] = parseTemplate(tmpl);
const visit = wrapWithCheck({
rule,
fn,
nodesExclude,
nodesInclude: [
node,
...nodesInclude,
],
});
parsed.push({
[type]: visit,
});
}
return parsed;