@@ -153,6 +153,7 @@ function checked(_, element) {
153
153
* @returns {boolean }
154
154
* Whether `element` matches `query`.
155
155
*/
156
+ // eslint-disable-next-line unicorn/prevent-abbreviations
156
157
function dir ( query , _1 , _2 , _3 , state ) {
157
158
assert ( query . argument , 'expected `argument`' )
158
159
assert ( query . argument . type === 'String' , 'expected plain text' )
@@ -270,9 +271,9 @@ function firstOfType(query, _1, _2, _3, state) {
270
271
function getCachedNthCheck ( query ) {
271
272
/** @type {(value: number) => boolean } */
272
273
// @ts -expect-error: cache.
273
- let fn = query . _cachedFn
274
+ let cachedFunction = query . _cachedFn
274
275
275
- if ( ! fn ) {
276
+ if ( ! cachedFunction ) {
276
277
const value = query . argument
277
278
assert ( value , 'expected `argument`' )
278
279
@@ -282,12 +283,12 @@ function getCachedNthCheck(query) {
282
283
)
283
284
}
284
285
285
- fn = nthCheck ( value . a + 'n+' + value . b )
286
+ cachedFunction = nthCheck ( value . a + 'n+' + value . b )
286
287
// @ts -expect-error: cache.
287
- query . _cachedFn = fn
288
+ query . _cachedFn = cachedFunction
288
289
}
289
290
290
- return fn
291
+ return cachedFunction
291
292
}
292
293
293
294
/**
@@ -484,9 +485,11 @@ function not(query, element, index, parent, state) {
484
485
* Whether `element` matches `query`.
485
486
*/
486
487
function nthChild ( query , _1 , _2 , _3 , state ) {
487
- const fn = getCachedNthCheck ( query )
488
+ const cachedFunction = getCachedNthCheck ( query )
488
489
assertDeep ( state , query )
489
- return typeof state . elementIndex === 'number' && fn ( state . elementIndex )
490
+ return (
491
+ typeof state . elementIndex === 'number' && cachedFunction ( state . elementIndex )
492
+ )
490
493
}
491
494
492
495
/**
@@ -506,12 +509,12 @@ function nthChild(query, _1, _2, _3, state) {
506
509
* Whether `element` matches `query`.
507
510
*/
508
511
function nthLastChild ( query , _1 , _2 , _3 , state ) {
509
- const fn = getCachedNthCheck ( query )
512
+ const cachedFunction = getCachedNthCheck ( query )
510
513
assertDeep ( state , query )
511
514
return Boolean (
512
515
typeof state . elementCount === 'number' &&
513
516
typeof state . elementIndex === 'number' &&
514
- fn ( state . elementCount - state . elementIndex - 1 )
517
+ cachedFunction ( state . elementCount - state . elementIndex - 1 )
515
518
)
516
519
}
517
520
@@ -532,12 +535,12 @@ function nthLastChild(query, _1, _2, _3, state) {
532
535
* Whether `element` matches `query`.
533
536
*/
534
537
function nthLastOfType ( query , _1 , _2 , _3 , state ) {
535
- const fn = getCachedNthCheck ( query )
538
+ const cachedFunction = getCachedNthCheck ( query )
536
539
assertDeep ( state , query )
537
540
return (
538
541
typeof state . typeCount === 'number' &&
539
542
typeof state . typeIndex === 'number' &&
540
- fn ( state . typeCount - 1 - state . typeIndex )
543
+ cachedFunction ( state . typeCount - 1 - state . typeIndex )
541
544
)
542
545
}
543
546
@@ -558,9 +561,9 @@ function nthLastOfType(query, _1, _2, _3, state) {
558
561
* Whether `element` matches `query`.
559
562
*/
560
563
function nthOfType ( query , _1 , _2 , _3 , state ) {
561
- const fn = getCachedNthCheck ( query )
564
+ const cachedFunction = getCachedNthCheck ( query )
562
565
assertDeep ( state , query )
563
- return typeof state . typeIndex === 'number' && fn ( state . typeIndex )
566
+ return typeof state . typeIndex === 'number' && cachedFunction ( state . typeIndex )
564
567
}
565
568
566
569
/**
0 commit comments