( segment: UrlSegmentGroup, fn: (v: UrlSegmentGroup, k: string) => T[], )
| 413 | } |
| 414 | |
| 415 | export 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 |
no test coverage detected