(chain: RouteChain, chains: RouteChain[], node: RouteNode)
| 73 | |
| 74 | /** Flattens a route node recursively and push each branch to the chains list. */ |
| 75 | const 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 | }; |
no test coverage detected