Codiga has joined Datadog!

Read the Blog
Skip to main content

AstString With Spread AST JavaScript Object

The AstStringWithSpread object represents a string in the AST with an additional attribute that indicates is there is a spread operator. It inherits the AstString object.


  • isSpread (type boolean): if the value is a spread value


The AstStringWithSpread is used when the spread operator (...) is used.

Examples of use:

foo = [1, 2, ...originalArray];

obj = { ...originalObj, key: newValue };

myFunction(a, ...iterableObj, b);

In the case of the function call (myFunction(a, ...iterableObj, b)), the second argument will behave exactly like a string except that the argument isSpread will exist and be true.