* Combine conditions and. * @param {Condition[]} conditions some conditions * @returns {Condition} merged condition
(conditions)
| 435 | * @returns {Condition} merged condition |
| 436 | */ |
| 437 | combineConditionsAnd(conditions) { |
| 438 | if (conditions.length === 0) { |
| 439 | return { |
| 440 | matchWhenEmpty: false, |
| 441 | fn: () => false |
| 442 | }; |
| 443 | } else if (conditions.length === 1) { |
| 444 | return conditions[0]; |
| 445 | } |
| 446 | return { |
| 447 | matchWhenEmpty: conditions.every((c) => c.matchWhenEmpty), |
| 448 | fn: (v) => conditions.every((c) => c.fn(v)) |
| 449 | }; |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * Returns an error object. |