Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a way to set getChildren to more than one condition? #49

Open
stoplion opened this issue Apr 19, 2019 · 1 comment
Open

a way to set getChildren to more than one condition? #49

stoplion opened this issue Apr 19, 2019 · 1 comment
Labels

Comments

@stoplion
Copy link

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
});
@ngryman
Copy link
Owner

ngryman commented Jun 27, 2019

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants