-
-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Are we able to get append/prepend API for inserting calls in function bodies? Currently the append/prepend API only works for the tree body.
Example:
function test() {
foo('test');
}Fails: c.body.node[0].body.append('bar();').
So I looked for workarounds. I tried to manually push this new call into the body array via c.body.node[0].body.body.push('bar();'). But doing so fails because bar(); is a string and not an esprima object. A possible solution is to expose AST-query nodes modules so we can do the above. Or add documentation that the body array requires an esprima object.
I can code this change, just need vision.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels