Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'map', 'filter', 'reduce', 'forEach', 'every', 'some'
].includes(property.name))) {
return
}
if (node.arguments.length === 0) {
return
}
const arg = node.arguments[0]
if (!['ArrowFunctionExpression', 'FunctionExpression'].includes(arg.type)) {
return
}
if (arg.body.type !== 'BlockStatement') {
const fn = template.smart(`
{
return VAR
}
`)
arg.body = fn({
VAR: arg.body
})
}
_protect(t, path.get('arguments')[0])
}
constructor(props: Props, parserOptions: ParserOptions = {}) {
const baseNode = template.smart(
props.code,
_.merge(parserOptions, props.options) as TemplateBuilderOptions
)(props.replacements as PublicReplacements);
const scopePath = flattenPath(props.scopePath);
super(
props.scopePath && scopePath.length
? _.get(baseNode, scopePath)
: baseNode,
props,
{
bodyPath: props.bodyPath || 'body.body',
parentBodyPath: props.parentBodyPath
}
);
}
}