How to use the esprima.Syntax.CallExpression function in esprima

To help you get started, we’ve selected a few esprima examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / ui5-builder / lib / lbt / utils / ASTUtils.js View on Github external
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);
}
github stryker-mutator / stryker / packages / stryker / src / mutators / ArrayDeclaratorMutator.ts View on Github external
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;
    }
  }
}