UNPKG

@wroud/navigation

Version:

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

44 lines 1.34 kB
import type { NodeType } from "./types.js"; /** * TrieNode represents a node in the pattern matching trie */ export declare class TrieNode { readonly type: NodeType; readonly name: string; readonly children: Map<string, TrieNode>; paramChild: TrieNode | null; wildcardChild: TrieNode | null; isEndOfPattern: boolean; pattern: string | null; parent: TrieNode | null; constructor(type?: NodeType, name?: string, parent?: TrieNode | null); /** * Mark this node as the end of a pattern */ markAsPatternEnd(pattern: string): this; /** * Get a static child node by segment name */ getStaticChild(segment: string): TrieNode | undefined; /** * Check if this node has a static child for the given segment */ hasStaticChild(segment: string): boolean; /** * Add a static child node for the given segment */ addStaticChild(segment: string): TrieNode; /** * Get or create a parameter child node */ getOrCreateParamChild(paramName: string): TrieNode; /** * Get or create a wildcard child node */ getOrCreateWildcardChild(wildcardName: string): TrieNode; /** * Find all patterns that are ancestors of this node */ findAncestorPatterns(): string[]; } //# sourceMappingURL=TrieNode.d.ts.map