ESQuery is a library for querying the AST output by Esprima for patterns of syntax using a CSS style selector system. (Evacuated from Microsoft Github)
anonymous 27834d6169 typo | 5 anni fa | |
---|---|---|
debian | 5 anni fa | |
tests | 6 anni fa | |
.gitignore | 11 anni fa | |
.npmignore | 10 anni fa | |
.travis.yml | 9 anni fa | |
Makefile | 11 anni fa | |
README.md | 10 anni fa | |
esquery.js | 6 anni fa | |
grammar.pegjs | 7 anni fa | |
license.txt | 11 anni fa | |
package.json | 6 anni fa | |
parser.js | 7 anni fa | |
testRunner.html | 11 anni fa |
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:
The following selectors are supported:
ForStatement
*
[attr]
[attr="foo"]
or [attr=123]
[attr=/foo.*/]
[attr!="foo"]
, [attr>2]
, [attr<3]
, [attr>=2]
, or [attr<=3]
[attr.level2="foo"]
FunctionDeclaration > Identifier.id
:first-child
or :last-child
:nth-child(2)
:nth-last-child(1)
ancestor descendant
parent > child
node ~ sibling
node + adjacent
:not(ForStatement)
:matches([attr] > :first-child, :last-child)
!IfStatement > [name="foo"]
:statement
, :expression
, :declaration
, :function
, or :pattern