Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const printAST = (a) => isStr(a) ? a : print(a);
const getFn = (a) => (...args) => {
find(ast, {push}) {
const oldCode = print(ast);
transform(ast, oldCode, name);
const newCode = print(ast);
if (newCode === oldCode)
return;
const positions = getPositions(oldCode, newCode);
for (const start of positions) {
const node = {
loc: {
start,
},
};
const path = {
node,
find(ast, {push}) {
const oldCode = print(ast);
transform(ast, oldCode, name);
const newCode = print(ast);
if (newCode === oldCode)
return;
const positions = getPositions(oldCode, newCode);
for (const start of positions) {
const node = {
loc: {
start,
},
};
const path = {
node,
};
const ast = parse(clearSource, {
parser,
isTS,
isFlow,
isJSX,
});
const places = transform(ast, source, opts);
if (!opts.fix)
return {
code: source,
places,
};
const printed = print(ast);
const code = `${shebang}${printed}`;
return {
code,
places,
};
};