@@ -153,6 +153,7 @@ function checked(_, element) {
153153 * @returns {boolean }
154154 * Whether `element` matches `query`.
155155 */
156+ // eslint-disable-next-line unicorn/prevent-abbreviations
156157function dir ( query , _1 , _2 , _3 , state ) {
157158 assert ( query . argument , 'expected `argument`' )
158159 assert ( query . argument . type === 'String' , 'expected plain text' )
@@ -270,9 +271,9 @@ function firstOfType(query, _1, _2, _3, state) {
270271function getCachedNthCheck ( query ) {
271272 /** @type {(value: number) => boolean } */
272273 // @ts -expect-error: cache.
273- let fn = query . _cachedFn
274+ let cachedFunction = query . _cachedFn
274275
275- if ( ! fn ) {
276+ if ( ! cachedFunction ) {
276277 const value = query . argument
277278 assert ( value , 'expected `argument`' )
278279
@@ -282,12 +283,12 @@ function getCachedNthCheck(query) {
282283 )
283284 }
284285
285- fn = nthCheck ( value . a + 'n+' + value . b )
286+ cachedFunction = nthCheck ( value . a + 'n+' + value . b )
286287 // @ts -expect-error: cache.
287- query . _cachedFn = fn
288+ query . _cachedFn = cachedFunction
288289 }
289290
290- return fn
291+ return cachedFunction
291292}
292293
293294/**
@@ -484,9 +485,11 @@ function not(query, element, index, parent, state) {
484485 * Whether `element` matches `query`.
485486 */
486487function nthChild ( query , _1 , _2 , _3 , state ) {
487- const fn = getCachedNthCheck ( query )
488+ const cachedFunction = getCachedNthCheck ( query )
488489 assertDeep ( state , query )
489- return typeof state . elementIndex === 'number' && fn ( state . elementIndex )
490+ return (
491+ typeof state . elementIndex === 'number' && cachedFunction ( state . elementIndex )
492+ )
490493}
491494
492495/**
@@ -506,12 +509,12 @@ function nthChild(query, _1, _2, _3, state) {
506509 * Whether `element` matches `query`.
507510 */
508511function nthLastChild ( query , _1 , _2 , _3 , state ) {
509- const fn = getCachedNthCheck ( query )
512+ const cachedFunction = getCachedNthCheck ( query )
510513 assertDeep ( state , query )
511514 return Boolean (
512515 typeof state . elementCount === 'number' &&
513516 typeof state . elementIndex === 'number' &&
514- fn ( state . elementCount - state . elementIndex - 1 )
517+ cachedFunction ( state . elementCount - state . elementIndex - 1 )
515518 )
516519}
517520
@@ -532,12 +535,12 @@ function nthLastChild(query, _1, _2, _3, state) {
532535 * Whether `element` matches `query`.
533536 */
534537function nthLastOfType ( query , _1 , _2 , _3 , state ) {
535- const fn = getCachedNthCheck ( query )
538+ const cachedFunction = getCachedNthCheck ( query )
536539 assertDeep ( state , query )
537540 return (
538541 typeof state . typeCount === 'number' &&
539542 typeof state . typeIndex === 'number' &&
540- fn ( state . typeCount - 1 - state . typeIndex )
543+ cachedFunction ( state . typeCount - 1 - state . typeIndex )
541544 )
542545}
543546
@@ -558,9 +561,9 @@ function nthLastOfType(query, _1, _2, _3, state) {
558561 * Whether `element` matches `query`.
559562 */
560563function nthOfType ( query , _1 , _2 , _3 , state ) {
561- const fn = getCachedNthCheck ( query )
564+ const cachedFunction = getCachedNthCheck ( query )
562565 assertDeep ( state , query )
563- return typeof state . typeIndex === 'number' && fn ( state . typeIndex )
566+ return typeof state . typeIndex === 'number' && cachedFunction ( state . typeIndex )
564567}
565568
566569/**
0 commit comments