0.0.9 • Published 3 years ago
babylon-query v0.0.9
babylon-query queries a Babylon AST using a esquery-style syntax to define syntactic filters, and returning @babel/traverse-ready NodePaths.
Try the demonstration here!
Selector types:
- Type 
Identifier - Wildcard 
* - Negation 
:not(Identifier, ExpressionStatement) - Matches-Any 
:is(Identifier, ExpressionStatement) - Relational 
:has(> Identifier.id) - Ancestry 
CallStatement.body:is(BlockStatement).body.0 - Attribute
 - Root path 
:root :nth-childnth-child(3n+1)first-childlast-child
- Combinators
- Descendant 
 - Child 
> - Next-sibling 
+ - Subsequent-sibling 
~ 
 - Descendant