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 лет назад | |
---|---|---|
debian | 5 лет назад | |
tests | 6 лет назад | |
.gitignore | 11 лет назад | |
.npmignore | 10 лет назад | |
.travis.yml | 9 лет назад | |
Makefile | 11 лет назад | |
README.md | 10 лет назад | |
esquery.js | 6 лет назад | |
grammar.pegjs | 7 лет назад | |
license.txt | 11 лет назад | |
package.json | 6 лет назад | |
parser.js | 7 лет назад | |
testRunner.html | 11 лет назад |
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