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 | il y a 5 ans | |
---|---|---|
debian | il y a 5 ans | |
tests | il y a 6 ans | |
.gitignore | il y a 11 ans | |
.npmignore | il y a 10 ans | |
.travis.yml | il y a 9 ans | |
Makefile | il y a 11 ans | |
README.md | il y a 10 ans | |
esquery.js | il y a 6 ans | |
grammar.pegjs | il y a 7 ans | |
license.txt | il y a 11 ans | |
package.json | il y a 6 ans | |
parser.js | il y a 7 ans | |
testRunner.html | il y a 11 ans |
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