babylon-query
v0.0.9
Published
@babel/traverse compatible esquery port
Downloads
2
Readme
babylon-query
queries a Babylon AST using a esquery
-style syntax to define syntactic filters, and returning @babel/traverse
-ready NodePath
s.
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-child
nth-child(3n+1)
first-child
last-child
- Combinators
- Descendant
- Child
>
- Next-sibling
+
- Subsequent-sibling
~
- Descendant