* Find a predicate with a specific operator and value
( predicates: Array<BasicExpression<boolean>>, operator: string, value: any, )
| 1032 | * Find a predicate with a specific operator and value |
| 1033 | */ |
| 1034 | function findPredicateWithOperator( |
| 1035 | predicates: Array<BasicExpression<boolean>>, |
| 1036 | operator: string, |
| 1037 | value: any, |
| 1038 | ): BasicExpression<boolean> | undefined { |
| 1039 | return predicates.find((p) => { |
| 1040 | if (p.type === `func`) { |
| 1041 | const f = p as Func |
| 1042 | const field = extractComparisonField(f) |
| 1043 | return f.name === operator && field && areValuesEqual(field.value, value) |
| 1044 | } |
| 1045 | return false |
| 1046 | }) |
| 1047 | } |
| 1048 | |
| 1049 | function areExpressionsEqual(a: BasicExpression, b: BasicExpression): boolean { |
| 1050 | if (a.type !== b.type) { |
no test coverage detected