Closed trueadm closed 3 months ago
Or better still, abort all subsequent traversal:
traverse(program, {
Identifier(path) {
if (path.node.name === 'Waldo') {
console.log('found him');
path.abort();
}
}
});
We have something similar to abort - https://estree-toolkit.netlify.app/traversal/#stopping-traversal. But it totally stops the traversal, so I don't think it's what you want.
New version has it - skipChildren
Fantastic, thanks so much! this.stop()
is what I was looking for, but skipChildren
is also super helpful
Today
path.skip()
only applies to the current node, it would be great to skip the traversal of all children of that given path too.