MCPcopy Create free account
hub / github.com/TanStack/db / canOptimizeAndExpression

Function canOptimizeAndExpression

packages/db/src/utils/index-optimization.ts:670–680  ·  view source on GitHub ↗

* Checks if an AND expression can be optimized

(expression: BasicExpression, collection: CollectionLike<T, TKey>)

Source from the content-addressed store, hash-verified

668 * Checks if an AND expression can be optimized
669 */
670function canOptimizeAndExpression<
671 T extends object,
672 TKey extends string | number,
673>(expression: BasicExpression, collection: CollectionLike<T, TKey>): boolean {
674 if (expression.type !== `func` || expression.args.length < 2) {
675 return false
676 }
677
678 // If any argument can be optimized, we can gain some speedup
679 return expression.args.some((arg) => canOptimizeExpression(arg, collection))
680}
681
682/**
683 * Optimizes OR expressions

Callers 1

canOptimizeExpressionFunction · 0.85

Calls 1

canOptimizeExpressionFunction · 0.85

Tested by

no test coverage detected