* Constructs a `RouteTree` from an object representation. * This method is used to recreate a `RouteTree` instance from an array of metadata objects. * The array should be in the format produced by `toObject`, allowing for the reconstruction of the route tree * with the same routes and meta
(value: SerializableRouteTreeNode)
| 173 | * @returns A new `RouteTree` instance constructed from the provided metadata objects. |
| 174 | */ |
| 175 | static fromObject(value: SerializableRouteTreeNode): RouteTree { |
| 176 | const tree = new RouteTree(); |
| 177 | |
| 178 | for (const { route, ...metadata } of value) { |
| 179 | tree.insert(route, metadata); |
| 180 | } |
| 181 | |
| 182 | return tree; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * A generator function that recursively traverses the route tree and yields the metadata of each node. |
no test coverage detected