( missing: RouteHas[] | undefined, url: URL, headers: Headers )
| 118 | * Checks if all "missing" conditions are satisfied (i.e., none of them match) |
| 119 | */ |
| 120 | export function checkMissingConditions( |
| 121 | missing: RouteHas[] | undefined, |
| 122 | url: URL, |
| 123 | headers: Headers |
| 124 | ): boolean { |
| 125 | if (!missing || missing.length === 0) { |
| 126 | return true |
| 127 | } |
| 128 | |
| 129 | for (const condition of missing) { |
| 130 | const actualValue = getConditionValue(condition, url, headers) |
| 131 | const result = matchesCondition(actualValue, condition.value) |
| 132 | |
| 133 | // If any missing condition matches, the check fails |
| 134 | if (result.matched) { |
| 135 | return false |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | return true |
| 140 | } |
no test coverage detected