MCPcopy
hub / github.com/angular/angular / mergeTrivialChildren

Function mergeTrivialChildren

packages/router/src/url_tree.ts:870–877  ·  view source on GitHub ↗

* When possible, merges the primary outlet child into the parent `UrlSegmentGroup`. * * When a segment group has only one child which is a primary outlet, merges that child into the * parent. That is, the child segment group's segments are merged into the `s` and the child's * children become th

(s: UrlSegmentGroup)

Source from the content-addressed store, hash-verified

868 * group into the parent.
869 */
870function mergeTrivialChildren(s: UrlSegmentGroup): UrlSegmentGroup {
871 if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {
872 const c = s.children[PRIMARY_OUTLET];
873 return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);
874 }
875
876 return s;
877}
878
879export function isUrlTree(v: any): v is UrlTree {
880 return v instanceof UrlTree;

Callers 1

squashSegmentGroupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…