( container: UrlSegmentGroup, containee: UrlSegmentGroup, containeePaths: UrlSegment[], matrixParams: ParamMatchOptions, )
| 181 | } |
| 182 | |
| 183 | function containsSegmentGroupHelper( |
| 184 | container: UrlSegmentGroup, |
| 185 | containee: UrlSegmentGroup, |
| 186 | containeePaths: UrlSegment[], |
| 187 | matrixParams: ParamMatchOptions, |
| 188 | ): boolean { |
| 189 | if (container.segments.length > containeePaths.length) { |
| 190 | const current = container.segments.slice(0, containeePaths.length); |
| 191 | if (!equalPath(current, containeePaths)) return false; |
| 192 | if (containee.hasChildren()) return false; |
| 193 | if (!matrixParamsMatch(current, containeePaths, matrixParams)) return false; |
| 194 | return true; |
| 195 | } else if (container.segments.length === containeePaths.length) { |
| 196 | if (!equalPath(container.segments, containeePaths)) return false; |
| 197 | if (!matrixParamsMatch(container.segments, containeePaths, matrixParams)) return false; |
| 198 | for (const c in containee.children) { |
| 199 | if (!container.children[c]) return false; |
| 200 | if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) { |
| 201 | return false; |
| 202 | } |
| 203 | } |
| 204 | return true; |
| 205 | } else { |
| 206 | const current = containeePaths.slice(0, container.segments.length); |
| 207 | const next = containeePaths.slice(container.segments.length); |
| 208 | if (!equalPath(container.segments, current)) return false; |
| 209 | if (!matrixParamsMatch(container.segments, current, matrixParams)) return false; |
| 210 | if (!container.children[PRIMARY_OUTLET]) return false; |
| 211 | return containsSegmentGroupHelper( |
| 212 | container.children[PRIMARY_OUTLET], |
| 213 | containee, |
| 214 | next, |
| 215 | matrixParams, |
| 216 | ); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | function matrixParamsMatch( |
| 221 | containerPaths: UrlSegment[], |
no test coverage detected
searching dependent graphs…