( segmentGroup: UrlSegmentGroup | undefined, startIndex: number, commands: readonly any[], )
| 381 | } |
| 382 | |
| 383 | function updateSegmentGroup( |
| 384 | segmentGroup: UrlSegmentGroup | undefined, |
| 385 | startIndex: number, |
| 386 | commands: readonly any[], |
| 387 | ): UrlSegmentGroup { |
| 388 | segmentGroup ??= new UrlSegmentGroup([], {}); |
| 389 | if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { |
| 390 | return updateSegmentGroupChildren(segmentGroup, startIndex, commands); |
| 391 | } |
| 392 | |
| 393 | const m = prefixedWith(segmentGroup, startIndex, commands); |
| 394 | const slicedCommands = commands.slice(m.commandIndex); |
| 395 | if (m.match && m.pathIndex < segmentGroup.segments.length) { |
| 396 | const g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {}); |
| 397 | g.children[PRIMARY_OUTLET] = new UrlSegmentGroup( |
| 398 | segmentGroup.segments.slice(m.pathIndex), |
| 399 | segmentGroup.children, |
| 400 | ); |
| 401 | return updateSegmentGroupChildren(g, 0, slicedCommands); |
| 402 | } else if (m.match && slicedCommands.length === 0) { |
| 403 | return new UrlSegmentGroup(segmentGroup.segments, {}); |
| 404 | } else if (m.match && !segmentGroup.hasChildren()) { |
| 405 | return createNewSegmentGroup(segmentGroup, startIndex, commands); |
| 406 | } else if (m.match) { |
| 407 | return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands); |
| 408 | } else { |
| 409 | return createNewSegmentGroup(segmentGroup, startIndex, commands); |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | function updateSegmentGroupChildren( |
| 414 | segmentGroup: UrlSegmentGroup, |
no test coverage detected
searching dependent graphs…