Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const nodes = esquery.query(AST, s);
// $ExpectType Node[]
esquery(AST, s);
// $ExpectError
esquery.parse(3);
// $ExpectType Node[]
esquery.match(AST, selector);
// $ExpectError
esquery.match(AST, 'VariableDeclarator');
// $ExpectType boolean
esquery.matches(nodes[0], selector, esquery(AST, 'FunctionDeclaration'));
// $ExpectError
esquery.match(3, selector);
switch (selector.type) {
case 'adjacent':
// $ExpectType SubjectSelector
selector.left;
// $ExpectType SubjectSelector
selector.right;
break;
case 'attribute':
// $ExpectType string
selector.name;
}
applySelector(node, selector) {
if (
esquery.matches(node, selector.parsedSelector, this.currentAncestry)
) {
this.emitter.emit(selector.rawSelector, node)
}
}
applySelector(node, selector) {
if (esquery.matches(node, selector.parsedSelector, this.currentAncestry)) {
this.emitter.emit(selector.rawSelector, node);
}
}
private applySelector(node: Node, selector: NodeSelector): void {
if (esquery.matches(node, selector.parsedSelector, this.currentAncestry)) {
this.emitter.emit(selector.rawSelector, node)
}
}
applySelector(node, selector) {
if (esquery.matches(node, selector.parsedSelector, this.currentAncestry)) {
this.emitter.emit(selector.rawSelector, node);
}
}