Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fix = (from, to, path) => {
const nodeFrom = template.ast(from);
const watermark = `${from} -> ${to}`;
path._putout = path._putout || [];
if (path._putout.includes(watermark))
return;
if (!compare(path, nodeFrom))
return;
if (!to)
return path.remove();
const nodeTo = template.ast.fresh(to);
const {node} = path;
const waysFrom = findVarsWays(nodeFrom);
const waysTo = findVarsWays(nodeTo);
const values = getValues({
waysFrom,
node,
});
replaceWith(path, nodeTo);