Function Call AST JavaScript Object
The FunctionCall
object matches a JavaScript function call.
The astType
value for this node is functioncall
.
Code Pattern
This object captures the following code pattern.
myFunction(argument1, argument2);
Attributes
functionName
(typeAstString
): the name of the functionarguments
(typeFunctionCallArguments
): the list of arguments
Usage
const functionCall = ...
// Get the function name
if (functionCall.functionName && functionCall.functionName.value) {
const functionName = functionCall.functionName.value;
}
// Get the list of all the arguments names
if (functionCall.arguments && functionCall.arguments.values) {
const argumentsNames = functionCall.arguments.values.filter(a => a.name && a.name.value).map(a => a.name.value);
}