* Try a single route as a candidate. Updates `state` in place when the * route matches and has a lower insertion index than the current best.
(state: MatchState, r: IndexedRoute)
| 347 | * route matches and has a lower insertion index than the current best. |
| 348 | */ |
| 349 | function tryRoute(state: MatchState, r: IndexedRoute): void { |
| 350 | if (r.index >= state.bestIndex) return; |
| 351 | if (!methodMatches(r.route.method, state.request.method)) return; |
| 352 | const params = r.route.pattern.exec(state.request.url); |
| 353 | if (!params) return; |
| 354 | state.bestRoute = r.route; |
| 355 | state.bestIndex = r.index; |
| 356 | state.bestParams = params; |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | * Walk the tree in lockstep with the pathname. `from` is the index of the |
no test coverage detected