esquery
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -86,2 +86,18 @@ /* vim: set sw=4 sts=4 : */ | ||
case 'has': | ||
var a, collector = []; | ||
for (i = 0, l = selector.selectors.length; i < l; ++i) { | ||
a = []; | ||
estraverse.traverse(node, { | ||
enter: function (node, parent) { | ||
if (parent != null) { a.unshift(parent); } | ||
if (matches(node, selector.selectors[i], a)) { | ||
collector.push(node); | ||
} | ||
}, | ||
leave: function () { a.shift(); } | ||
}); | ||
} | ||
return collector.length !== 0; | ||
case 'child': | ||
@@ -111,3 +127,3 @@ if (matches(node, selector.right, ancestry)) { | ||
switch (selector.value.type) { | ||
case 'regexp': return selector.value.value.test(p); | ||
case 'regexp': return typeof p === 'string' && selector.value.value.test(p); | ||
case 'literal': return '' + selector.value.value === '' + p; | ||
@@ -167,4 +183,8 @@ case 'type': return selector.value.value === typeof p; | ||
return node.type.slice(-10) === 'Expression' || | ||
node.type === 'Literal' || | ||
node.type === 'Identifier'; | ||
node.type.slice(-7) === 'Literal' || | ||
( | ||
node.type === 'Identifier' && | ||
(ancestry.length === 0 || ancestry[0].type !== 'MetaProperty') | ||
) || | ||
node.type === 'MetaProperty'; | ||
case 'function': | ||
@@ -171,0 +191,0 @@ return node.type.slice(0, 8) === 'Function' || |
{ | ||
"name": "esquery", | ||
"preferGlobal": false, | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Joel Feenstra <jrfeenst+esquery@gmail.com>", | ||
@@ -33,3 +33,3 @@ "description": "A query library for ECMAScript AST using a CSS selector like query language.", | ||
}, | ||
"license": "BSD", | ||
"license": "BSD-3-Clause", | ||
"engines": { | ||
@@ -36,0 +36,0 @@ "node": ">=0.6" |
Sorry, the diff of this file is too big to display
Nonpermissive License
License(Experimental) A package's licensing information has fine-grained problems
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license
Found 1 instance in 1 package
94954
0
0
100
2827