MCPcopy Create free account
hub / github.com/angular/angular / parseChildren

Method parseChildren

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

Source from the content-addressed store, hash-verified

724 }
725
726 private parseChildren(depth = 0): {[outlet: string]: UrlSegmentGroup} {
727 if (depth > 50) {
728 throw new RuntimeError(
729 RuntimeErrorCode.UNPARSABLE_URL,
730 (typeof ngDevMode === 'undefined' || ngDevMode) && 'URL is too deep',
731 );
732 }
733 if (this.remaining === '') {
734 return {};
735 }
736
737 this.consumeOptional('/');
738
739 const segments: UrlSegment[] = [];
740 if (!this.peekStartsWith('(')) {
741 segments.push(this.parseSegment());
742 }
743
744 while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {
745 this.capture('/');
746 segments.push(this.parseSegment());
747 }
748
749 let children: {[outlet: string]: UrlSegmentGroup} = {};
750 if (this.peekStartsWith('/(')) {
751 this.capture('/');
752 children = this.parseParens(true, depth);
753 }
754
755 let res: {[outlet: string]: UrlSegmentGroup} = {};
756 if (this.peekStartsWith('(')) {
757 res = this.parseParens(false, depth);
758 }
759
760 if (segments.length > 0 || Object.keys(children).length > 0) {
761 res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);
762 }
763
764 return res;
765 }
766
767 // parse a segment with its matrix parameters
768 // 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