Skip to content

Commit 50ae64e

Browse files
committed
remove ciruclar dependency passing any via state
1 parent ea7f88f commit 50ae64e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var any = require('./lib/any')
88
var parse = require('./lib/parse')
99

1010
function matches(selector, node) {
11-
return Boolean(any(parse(selector), node, {one: true, shallow: true})[0])
11+
return Boolean(any(parse(selector), node, {one: true, shallow: true, any})[0])
1212
}
1313

1414
function select(selector, node) {

lib/any.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ function rule(query, tree, state) {
5252
scopeNodes: tree.type === 'root' ? tree.children : [tree],
5353
iterator: iterator,
5454
one: state.one,
55-
shallow: state.shallow
55+
shallow: state.shallow,
56+
any: state.any
5657
})
5758
)
5859

lib/pseudo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = match
55
var zwitch = require('zwitch')
66
var not = require('not')
77
var convert = require('unist-util-is/convert')
8-
var anything = require('./any')
98

109
var is = convert()
1110

@@ -48,6 +47,7 @@ function match(query, node, index, parent, state) {
4847
function matches(query, node, index, parent, state) {
4948
var shallow = state.shallow
5049
var one = state.one
50+
var anything = state.any
5151
var result
5252

5353
state.one = true
@@ -147,6 +147,7 @@ function hasSelector(query, node, index, parent, state) {
147147
var one = state.one
148148
var scopeNodes = state.scopeNodes
149149
var value = appendScope(query.value)
150+
var anything = state.any
150151
var result
151152

152153
state.shallow = false

0 commit comments

Comments
 (0)