import { PathParameterValues } from '../types'; /** * A Node in the trie */ export interface Node { /** * Key of the node */ key: string; /** * Value of the node */ value?: T; /** * Children of the node */ readonly children: { [key: string]: Node; }; /** * Regular expression for the template */ regexp?: RegExp; /** * Names of the node if it contains named parameters */ names?: string[]; } export type NodeWithValue = Node & { value: T; }; export interface ResolvedNode { node: Node; params?: PathParameterValues; } /** * An implementation of trie for routes. The key hierarchy is built with parts * of the route path delimited by `/` */ export declare class Trie { readonly root: Node; /** * Create a node for a given path template * @param pathTemplate - The path template, * @param value - Value of the route */ create(routeTemplate: string, value: T): Node; /** * Match a route path against the trie * @param path - The route path, such as `/customers/c01` */ match(path: string): (ResolvedNode & { node: NodeWithValue; }) | undefined; /** * List all nodes with value of the trie */ list(): NodeWithValue[]; }