MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / flattenNode

Function flattenNode

core/src/components/router/utils/parser.ts:75–94  ·  view source on GitHub ↗
(chain: RouteChain, chains: RouteChain[], node: RouteNode)

Source from the content-addressed store, hash-verified

73
74/** Flattens a route node recursively and push each branch to the chains list. */
75const flattenNode = (chain: RouteChain, chains: RouteChain[], node: RouteNode) => {
76 chain = [
77 ...chain,
78 {
79 id: node.id,
80 segments: node.segments,
81 params: node.params,
82 beforeLeave: node.beforeLeave,
83 beforeEnter: node.beforeEnter,
84 },
85 ];
86
87 if (node.children.length === 0) {
88 chains.push(chain);
89 return;
90 }
91 for (const child of node.children) {
92 flattenNode(chain, chains, child);
93 }
94};

Callers 1

flattenRouterTreeFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected