UNPKG

@wroud/navigation

Version:

A flexible, pattern-matching navigation system for JavaScript applications with built-in routing, browser integration, and navigation state management

27 lines 1.06 kB
import type { RouteParams } from "../IRouteMatcher.js"; import { TrieNode } from "./TrieNode.js"; import type { ExtendedMatchResult } from "./types.js"; /** * Match a segment array against a trie, starting from the given node * * This function recursively traverses the trie to find a matching pattern * for the given segments. * * @param node The current node in the trie * @param segments The URL segments to match * @param index The current segment index * @param params The accumulated parameters * @returns Match result with parameters and pattern */ export declare function matchSegments(node: TrieNode, segments: string[], index: number, params: RouteParams): ExtendedMatchResult; /** * Sort match results by specificity: * 1. Static routes * 2. Parameter routes with more segments * 3. Wildcard routes * * @param results Array of match results to sort * @returns Sorted array of match results */ export declare function sortMatchResults(results: ExtendedMatchResult[]): ExtendedMatchResult[]; //# sourceMappingURL=matcher.d.ts.map