* A generator function that recursively traverses the route tree and yields the metadata of each node. * This allows for easy and efficient iteration over all nodes in the tree. * * @param node - The current node to start the traversal from. Defaults to the root node of the tree.
(
node: RouteTreeNode<AdditionalMetadata> = this.root,
)
| 189 | * @param node - The current node to start the traversal from. Defaults to the root node of the tree. |
| 190 | */ |
| 191 | *traverse( |
| 192 | node: RouteTreeNode<AdditionalMetadata> = this.root, |
| 193 | ): Generator<RouteTreeNodeMetadata & AdditionalMetadata> { |
| 194 | if (node.metadata) { |
| 195 | yield node.metadata; |
| 196 | } |
| 197 | |
| 198 | for (const childNode of node.children.values()) { |
| 199 | yield* this.traverse(childNode); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Extracts the path segments from a given route string. |
no test coverage detected