Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esquery.matches does not respect subject indicator. #25

Open
ikarienator opened this issue Apr 8, 2014 · 0 comments
Open

esquery.matches does not respect subject indicator. #25

ikarienator opened this issue Apr 8, 2014 · 0 comments

Comments

@ikarienator
Copy link
Contributor

var esprima = require('esprima');
var esquery = require('esquery');
var ast = esprima.parse('a + !b');
var query = esquery.parse('BinaryExpression! > UnaryExpression.right');

// should be true (does not work)
console.log(esquery.matches(ast.body[0].expression, query, [ast.body[0], ast]));
// should be false (does not work)
console.log(esquery.matches(ast.body[0].expression.right, query, [ast.body[0].expression, ast.body[0], ast]));

// should include only the BinaryExpression (works)
console.log(JSON.stringify(esquery.match(ast, query, []), null, 4));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant