| Server IP : 85.155.190.233 / Your IP : 216.73.216.103 Web Server : nginx/1.24.0 System : Linux antigravity-cli 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 User : wp-moonbloom ( 1001) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/doc/node-esquery/ |
Upload File : |
ESQuery is a library for querying the AST output by Esprima for patterns
of syntax using a CSS style selector system. Check out the demo:
demo
The following selectors are supported:
- AST node type: ForStatement
- wildcard: *
- attribute existence: [attr]
- attribute value: [attr="foo"] or [attr=123]
- attribute regex: [attr=/foo.*/] or (with flags) [attr=/foo.*/is]
- attribute conditions: [attr!="foo"], [attr>2], [attr<3], [attr>=2],
or [attr<=3]
- nested attribute: [attr.level2="foo"]
- field: FunctionDeclaration > Identifier.id
- First or last child: :first-child or :last-child
- nth-child (no ax+b support): :nth-child(2)
- nth-last-child (no ax+b support): :nth-last-child(1)
- descendant: ancestor descendant
- child: parent > child
- following sibling: node ~ sibling
- adjacent sibling: node + adjacent
- negation: :not(ForStatement)
- has: :has(ForStatement)
- matches-any: :matches([attr] > :first-child, :last-child)
- subject indicator: !IfStatement > [name="foo"]
- class of AST node: :statement, :expression, :declaration, :function,
or :pattern