@@ -9,10 +9,6 @@ type PathnamesLeaves = Array<{
99
1010const formatPathname = ( parts : Array < string > ) => `/${ parts . join ( "/" ) . slice ( 1 ) } ` ;
1111
12- /**
13- * Find matching pathnames for a given path
14- * Walk the tree. Return string[][], each element of which is a path
15- */
1612const recurse = (
1713 node : RadixNode < RouteData > ,
1814 parts : Array < string > ,
@@ -47,45 +43,6 @@ const recurse = (
4743 }
4844 }
4945
50- // if (matchAny) {
51- // // If this part is a wildcard, match any
52- // // If it's also the last part, include leaf children
53- // // Otherwise, recurse on all children
54- // if (isLast) {
55- // for (const [lastPart, child] of node.children.entries()) {
56- // if (child.data) {
57- // const value = {
58- // pathname: formatPathname([...walked, lastPart]),
59- // leaf: child.data.data as Leaf,
60- // };
61- // pathnames.push(value);
62- // }
63- // }
64- // } else {
65- // for (const [lastPart, child] of node.children.entries()) {
66- // pathnames.push(
67- // ...recurse(child, parts.slice(1), [...walked, lastPart])
68- // );
69- // }
70- // }
71- // } else if (node.children.has(part)) {
72- // // If this part is static, match it
73- // // If it's also the last part, include leaf child
74- // // Otherwise, recurse on child
75- // const child = node.children.get(part)!;
76- // if (isLast) {
77- // const value = {
78- // pathname: formatPathname([...walked, part]),
79- // leaf: child.data!.data as Leaf,
80- // };
81- // pathnames.push(value);
82- // } else {
83- // if (child) {
84- // pathnames.push(...recurse(child, parts.slice(1), [...walked, part]));
85- // }
86- // }
87- // }
88-
8946 return pathnames ;
9047} ;
9148
0 commit comments