Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function isMethodCall(node, methodPath) {
if ( node.type !== Syntax.CallExpression ) {
return false;
}
// BYFIELD ( BYFIELD ( BYFIELD ( a, b), c), d)
return isNamedObject(node.callee, methodPath, methodPath.length);
}
public applyMutations(node: IdentifiedNode, copy: (obj: T, deep?: boolean) => T): void | IdentifiedNode {
if ((node.type === Syntax.CallExpression || node.type === Syntax.NewExpression) && node.callee.type === Syntax.Identifier && node.callee.name === 'Array' && node.arguments.length > 0) {
const mutatedNode = copy(node);
mutatedNode.arguments = [];
return mutatedNode;
}
if (node.type === Syntax.ArrayExpression && node.elements.length > 0) {
const mutatedNode = copy(node);
mutatedNode.elements = [];
return mutatedNode;
}
}
}