tree-crawl
tree-crawl copied to clipboard
a way to set `getChildren` to more than one condition?
I have a tree that sometime has a args property and sometimes has a content property. Is a way to set getChildren to more than one condition?
crawl(tree, n => console.log(n.type, n.value || n.op), {
getChildren: node => node.args || node.content
});
Hey @stoplion,
Sorry for the very late answer 😅. I'm not sure I understand the question. It seems that your code snippet already selectively returns either args or content. Are you trying to achieve something else that I didn't understand?