* Checks if an AND expression can be optimized
(expression: BasicExpression, collection: CollectionLike<T, TKey>)
| 668 | * Checks if an AND expression can be optimized |
| 669 | */ |
| 670 | function 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 |
no test coverage detected