Question: Any guide on how to move from the traversal API to the new APIs?
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 194
- Avg merge
- 22h 43m
- Merged PRs (30d)
- 10
Description
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:
```js
// 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
});
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing the old traverse call with the new visit API, including the recast.types.traverse example, the early returns, and the CallExpression check shown here. A useful result would document the migration mapping and explain how traversal control flow and generic processing should be expressed with the new API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100