* 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>>, )
| 1222 | * @throws Error if the expressions array is empty |
| 1223 | */ |
| 1224 | function 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 | } |
no outgoing calls
no test coverage detected