MCPcopy
hub / github.com/TanStack/router / createRouteNodesByFullPath

Function createRouteNodesByFullPath

packages/router-generator/src/utils.ts:752–771  ·  view source on GitHub ↗
(
  routeNodes: Array<RouteNode>,
)

Source from the content-addressed store, hash-verified

750 * Creates a map from fullPath to routeNode
751 */
752export const createRouteNodesByFullPath = (
753 routeNodes: Array<RouteNode>,
754): Map<string, RouteNode> => {
755 const map = new Map<string, RouteNode>()
756
757 for (const routeNode of routeNodes) {
758 const fullPath = inferFullPath(routeNode)
759
760 if (fullPath === '/' && map.has('/')) {
761 const existing = map.get('/')!
762 if (shouldPreferIndexRoute(routeNode, existing)) {
763 continue
764 }
765 }
766
767 map.set(fullPath, routeNode)
768 }
769
770 return map
771}
772
773/**
774 * Create a map from 'to' to a routeNode

Callers 1

buildRouteTreeMethod · 0.90

Calls 5

inferFullPathFunction · 0.85
shouldPreferIndexRouteFunction · 0.85
getMethod · 0.65
setMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected