buxlabs / abstract-syntax-tree

A library for working with abstract syntax trees.
MIT License
110 stars 13 forks source link

Simplified syntax for the replace method #75

Closed emilos closed 4 years ago

emilos commented 4 years ago

It would be nice to be able to just do:

const tree = new AbstractSyntaxTree(source)
tree.replace(node => {})

instead of doing:

const tree = new AbstractSyntaxTree(source)
tree.replace({ enter(node) {} })