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

Function mapChildrenIntoArray

packages/router/src/url_tree.ts:415–431  ·  view source on GitHub ↗
(
  segment: UrlSegmentGroup,
  fn: (v: UrlSegmentGroup, k: string) => T[],
)

Source from the content-addressed store, hash-verified

413}
414
415export function mapChildrenIntoArray<T>(
416 segment: UrlSegmentGroup,
417 fn: (v: UrlSegmentGroup, k: string) => T[],
418): T[] {
419 let res: T[] = [];
420 Object.entries(segment.children).forEach(([childOutlet, child]) => {
421 if (childOutlet === PRIMARY_OUTLET) {
422 res = res.concat(fn(child, childOutlet));
423 }
424 });
425 Object.entries(segment.children).forEach(([childOutlet, child]) => {
426 if (childOutlet !== PRIMARY_OUTLET) {
427 res = res.concat(fn(child, childOutlet));
428 }
429 });
430 return res;
431}
432
433/**
434 * @description

Callers 1

serializeSegmentFunction · 0.85

Calls 3

fnFunction · 0.50
forEachMethod · 0.45
entriesMethod · 0.45

Tested by

no test coverage detected