Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.fix = ({path, value}) => {
const [line, arg] = value.split(' -- ');
const scripts = getScripts(line);
const strs = [];
for (const script of scripts) {
strs.push(stringLiteral(script));
}
const runArgs = getRunArgs(strs, arg);
path.node.body = callExpression(identifier('run'), runArgs);
};
function getRunArgs(strs, arg) {
if (!arg)
return [
arrayExpression(strs),
];
return [
arrayExpression(strs),
stringLiteral(arg),
];
}