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

Question: Any guide on how to move from the traversal API to the new APIs? #575

Open
SiddharthShyniben opened this issue Jul 16, 2021 · 0 comments

Comments

@SiddharthShyniben
Copy link

I've seen some old code using the traverse function – and I want to move it to the new APIs (visit). Any guide on this?

If you like, here's what my code looks like:

// Using recast BTW
recast.types.traverse(ast, function (node) {
  if (node.__stepper) return false;
  if (types.CallExpression.check(node)) {
    // Whatever
  }

  // a bunch more ifs 
  if (myoptions.someoption) return;

  // some generic code which is run anyways
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant