You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -294,8 +297,12 @@ function generateMatcher(selector) {
294
297
}
295
298
296
299
case'class': {
300
+
297
301
constname=selector.name.toLowerCase();
298
-
return(node,ancestry)=>{
302
+
return(node,ancestry,options)=>{
303
+
304
+
if(options&&options.nodeTypeKey)returnfalse;
305
+
299
306
switch(name){
300
307
case'statement':
301
308
if(node.type.slice(-9)==='Statement')returntrue;
@@ -333,6 +340,7 @@ function generateMatcher(selector) {
333
340
*/
334
341
/**
335
342
* @typedef {object} ESQueryOptions
343
+
* @property {string} [nodeTypeKey="type"] By passing `nodeTypeKey`, we can allow other ASTs to use ESQuery.
336
344
* @property { { [nodeType: string]: string[] } } [visitorKeys] By passing `visitorKeys` mapping, we can extend the properties of the nodes that traverse the node.
337
345
* @property {TraverseOptionFallback} [fallback] By passing `fallback` option, we can control the properties of traversing nodes when encountering unknown nodes.
338
346
*/
@@ -363,7 +371,9 @@ function matches(node, selector, ancestry, options) {
0 commit comments