MCPcopy Index your code
hub / github.com/TanStack/db / combineWithAnd

Function combineWithAnd

packages/db/src/query/optimizer.ts:1224–1237  ·  view source on GitHub ↗

* Helper function to combine multiple expressions with AND. * * If there's only one expression, it's returned as-is. * If there are multiple expressions, they're combined with an AND function. * * @param expressions - Array of expressions to combine * @returns Single expression representing th

(
  expressions: Array<BasicExpression<boolean>>,
)

Source from the content-addressed store, hash-verified

1222 * @throws Error if the expressions array is empty
1223 */
1224function combineWithAnd(
1225 expressions: Array<BasicExpression<boolean>>,
1226): BasicExpression<boolean> {
1227 if (expressions.length === 0) {
1228 throw new CannotCombineEmptyExpressionListError()
1229 }
1230
1231 if (expressions.length === 1) {
1232 return expressions[0]!
1233 }
1234
1235 // Create an AND function with all expressions as arguments
1236 return new Func(`and`, expressions)
1237}

Callers 3

groupWhereClausesFunction · 0.85
applyOptimizationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected