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

Function checkOutletNameUniqueness

packages/router/src/recognize.ts:614–629  ·  view source on GitHub ↗
(nodes: TreeNode<ActivatedRouteSnapshot>[])

Source from the content-addressed store, hash-verified

612}
613
614function checkOutletNameUniqueness(nodes: TreeNode<ActivatedRouteSnapshot>[]): void {
615 const names: {[k: string]: ActivatedRouteSnapshot} = Object.create(null);
616 nodes.forEach((n) => {
617 const routeWithSameOutletName = names[n.value.outlet];
618 if (routeWithSameOutletName) {
619 const p = routeWithSameOutletName.url.map((s) => s.toString()).join('/');
620 const c = n.value.url.map((s) => s.toString()).join('/');
621 throw new RuntimeError(
622 RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET,
623 (typeof ngDevMode === 'undefined' || ngDevMode) &&
624 `Two segments cannot have the same outlet name: '${p}' and '${c}'.`,
625 );
626 }
627 names[n.value.outlet] = n.value;
628 });
629}
630
631function getData(route: Route): Data {
632 return route.data || {};

Callers 1

mergeEmptyPathMatchesFunction · 0.85

Calls 5

mapMethod · 0.80
createMethod · 0.65
joinMethod · 0.65
toStringMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected