(nodes: RouteTree)
| 64 | * Each chain represents a path from the root node to a terminal node. |
| 65 | */ |
| 66 | export const flattenRouterTree = (nodes: RouteTree): RouteChain[] => { |
| 67 | const chains: RouteChain[] = []; |
| 68 | for (const node of nodes) { |
| 69 | flattenNode([], chains, node); |
| 70 | } |
| 71 | return chains; |
| 72 | }; |
| 73 | |
| 74 | /** Flattens a route node recursively and push each branch to the chains list. */ |
| 75 | const flattenNode = (chain: RouteChain, chains: RouteChain[], node: RouteNode) => { |
no test coverage detected