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