( /** The path to match. */ path: string, /** The `processedTree` returned by the initial `processRouteTree` call. */ processedTree: ProcessedTree<any, T, any>, )
| 693 | * Take an arbitrary list of routes, create a tree from them (if it hasn't been created already), and match a path against it. |
| 694 | */ |
| 695 | export function findFlatMatch<T extends Extract<RouteLike, { from: string }>>( |
| 696 | /** The path to match. */ |
| 697 | path: string, |
| 698 | /** The `processedTree` returned by the initial `processRouteTree` call. */ |
| 699 | processedTree: ProcessedTree<any, T, any>, |
| 700 | ) { |
| 701 | path ||= '/' |
| 702 | const cached = processedTree.flatCache!.get(path) |
| 703 | if (cached) return cached |
| 704 | const result = findMatch(path, processedTree.masksTree!) |
| 705 | processedTree.flatCache!.set(path, result) |
| 706 | return result |
| 707 | } |
| 708 | |
| 709 | /** |
| 710 | * @deprecated keep until v2 so that `router.matchRoute` can keep not caring about the actual route tree |
no test coverage detected