Skip to content

Commit 89f8735

Browse files
committed
move needsIndex into local scope
Configure function is the sole consumer of the needsIndex array, it shoould then be in it's local scope. This change further improves code quiality.
1 parent edf20d2 commit 89f8735

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/any.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@
22

33
module.exports = match
44

5-
var needsIndex = [
6-
'first-child',
7-
'first-of-type',
8-
'last-child',
9-
'last-of-type',
10-
'nth-child',
11-
'nth-last-child',
12-
'nth-of-type',
13-
'nth-last-of-type',
14-
'only-child',
15-
'only-of-type'
16-
]
17-
185
var zwitch = require('zwitch')
196
var test = require('./test')
207
var nest = require('./nest')
@@ -84,6 +71,18 @@ function rule(query, tree, state) {
8471
}
8572

8673
function configure(query, state) {
74+
var needsIndex = [
75+
'first-child',
76+
'first-of-type',
77+
'last-child',
78+
'last-of-type',
79+
'nth-child',
80+
'nth-last-child',
81+
'nth-of-type',
82+
'nth-last-of-type',
83+
'only-child',
84+
'only-of-type'
85+
]
8786
var pseudos = query.pseudos || []
8887
var index = -1
8988

0 commit comments

Comments
 (0)