You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			|  | 5 months ago | |
|---|---|---|
| .. | ||
| README.md | 5 months ago | |
| esquery.js | 5 months ago | |
| license.txt | 5 months ago | |
| package.json | 5 months ago | |
| parser.js | 5 months ago | |
		
			
				
				README.md
			
		
		
			
			
		
	
	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:
- AST node type: ForStatement
- wildcard: *
- attribute existence: [attr]
- attribute value: [attr="foo"]or[attr=123]
- attribute regex: [attr=/foo.*/]
- attribute conditons: [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-childor: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)
- matches-any: :matches([attr] > :first-child, :last-child)
- subject indicator: !IfStatement > [name="foo"]
- class of AST node: :statement,:expression,:declaration,:function, or:pattern
