estools / estraverse

ECMAScript JS AST traversal functions
BSD 2-Clause "Simplified" License
937 stars 131 forks source link

Add `enter` callback as a second .traverse arg #77

Closed a-x- closed 6 years ago

a-x- commented 8 years ago

I suggest making the .traverse method more polymorphic.

is it cool to write:

traverse.traverse(ast, node => isBemjson(node) && bemjsons.push(this.nodeToObject(node)));

insted of:

traverse.traverse(ast, {
    enter: node => isBemjson(node) && bemjsons.push(this.nodeToObject(node))
});