MCPcopy
hub / github.com/angular/angular / parseChildren

Method parseChildren

packages/router/src/url_tree.ts:646–685  ·  view source on GitHub ↗
(depth = 0)

Source from the content-addressed store, hash-verified

644 }
645
646 private parseChildren(depth = 0): {[outlet: string]: UrlSegmentGroup} {
647 if (depth > 50) {
648 throw new RuntimeError(
649 RuntimeErrorCode.UNPARSABLE_URL,
650 (typeof ngDevMode === 'undefined' || ngDevMode) && 'URL is too deep',
651 );
652 }
653 if (this.remaining === '') {
654 return {};
655 }
656
657 this.consumeOptional('/');
658
659 const segments: UrlSegment[] = [];
660 if (!this.peekStartsWith('(')) {
661 segments.push(this.parseSegment());
662 }
663
664 while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {
665 this.capture('/');
666 segments.push(this.parseSegment());
667 }
668
669 let children: {[outlet: string]: UrlSegmentGroup} = {};
670 if (this.peekStartsWith('/(')) {
671 this.capture('/');
672 children = this.parseParens(true, depth);
673 }
674
675 let res: {[outlet: string]: UrlSegmentGroup} = {};
676 if (this.peekStartsWith('(')) {
677 res = this.parseParens(false, depth);
678 }
679
680 if (segments.length > 0 || Object.keys(children).length > 0) {
681 res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);
682 }
683
684 return res;
685 }
686
687 // parse a segment with its matrix parameters
688 // ie `name;k1=v1;k2`

Callers 2

parseRootSegmentMethod · 0.95
parseParensMethod · 0.95

Calls 7

consumeOptionalMethod · 0.95
peekStartsWithMethod · 0.95
parseSegmentMethod · 0.95
captureMethod · 0.95
parseParensMethod · 0.95
keysMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected