Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function FunctionHandler(node) {
const body = this.transformBlock(node.body);
const restParam = node.params.find(param => bt.isRestElement(param));
if (restParam) {
body.unshift(
t.localStatement(
[restParam.argument],
[t.tableConstructorExpression([t.tableValue(t.varargLiteral())])],
),
);
}
return t.functionStatement(
isExp ? null : this.transform(node.id),
this.transformList(node.params),
// Simulate module structure for declaration
!isExp,
body,
);
};
}
export function VariableDeclarator(node) {
return t.localStatement([this.transform(node.id)], [this.transform(node.init)]);
}