( container: UrlSegmentGroup, containee: UrlSegmentGroup, containeePaths: UrlSegment[], matrixParams: ParamMatchOptions, )
| 206 | } |
| 207 | |
| 208 | function containsSegmentGroupHelper( |
| 209 | container: UrlSegmentGroup, |
| 210 | containee: UrlSegmentGroup, |
| 211 | containeePaths: UrlSegment[], |
| 212 | matrixParams: ParamMatchOptions, |
| 213 | ): boolean { |
| 214 | if (container.segments.length > containeePaths.length) { |
| 215 | const current = container.segments.slice(0, containeePaths.length); |
| 216 | if (!equalPath(current, containeePaths)) return false; |
| 217 | if (containee.hasChildren()) return false; |
| 218 | if (!matrixParamsMatch(current, containeePaths, matrixParams)) return false; |
| 219 | return true; |
| 220 | } else if (container.segments.length === containeePaths.length) { |
| 221 | if (!equalPath(container.segments, containeePaths)) return false; |
| 222 | if (!matrixParamsMatch(container.segments, containeePaths, matrixParams)) return false; |
| 223 | for (const c in containee.children) { |
| 224 | if (!container.children[c]) return false; |
| 225 | if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) { |
| 226 | return false; |
| 227 | } |
| 228 | } |
| 229 | return true; |
| 230 | } else { |
| 231 | const current = containeePaths.slice(0, container.segments.length); |
| 232 | const next = containeePaths.slice(container.segments.length); |
| 233 | if (!equalPath(container.segments, current)) return false; |
| 234 | if (!matrixParamsMatch(container.segments, current, matrixParams)) return false; |
| 235 | if (!container.children[PRIMARY_OUTLET]) return false; |
| 236 | return containsSegmentGroupHelper( |
| 237 | container.children[PRIMARY_OUTLET], |
| 238 | containee, |
| 239 | next, |
| 240 | matrixParams, |
| 241 | ); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | function matrixParamsMatch( |
| 246 | containerPaths: UrlSegment[], |
no test coverage detected