MCPcopy
hub / github.com/angular/angular / parseRootSegment

Method parseRootSegment

packages/router/src/url_tree.ts:617–630  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

615 }
616
617 parseRootSegment(): UrlSegmentGroup {
618 // Consume all leading slashes. Multiple consecutive leading slashes (e.g. `///path`)
619 // are not meaningful and would otherwise produce a `//path`-style serialized URL,
620 // which browsers interpret as protocol-relative (resolving to a different origin)
621 // and reject with a SecurityError when passed to `history.pushState`/`replaceState`.
622 while (this.consumeOptional('/')) {}
623
624 if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) {
625 return new UrlSegmentGroup([], {});
626 }
627
628 // The root segment group never has segments
629 return new UrlSegmentGroup([], this.parseChildren());
630 }
631
632 parseQueryParams(): Params {
633 const params: Params = {};

Callers 1

parseMethod · 0.95

Calls 3

consumeOptionalMethod · 0.95
peekStartsWithMethod · 0.95
parseChildrenMethod · 0.95

Tested by

no test coverage detected