Reminist - v1.0.6
    Preparing search index...

    Class Node<Data, Path, Endpoint>

    Represents a single node in the routing tree.

    Type Parameters

    • Data

      The type of data associated with this node (e.g., a handler).

    • Path extends string

      The string literal representing the segment name.

    • Endpoint extends boolean

      Whether this node is a final route segment.

    Index

    Constructors

    Properties

    catchAllChild: Node<Data, any, any> | null = null

    Child node for catch-all segments (e.g., '[...slug]')

    childCount: number = 0

    Total number of direct children

    dynamicChild: Node<Data, any, any> | null = null

    Child node for simple dynamic segments (e.g., ':id')

    dynamicChildCount: number = 0

    Number of non-static children

    endpoint: Endpoint

    Indicates if this node marks the end of a valid route

    name: string

    The name of this path segment

    optionalCatchAllChild: Node<Data, any, any> | null = null

    Child node for optional catch-all segments (e.g., '[[...slug]]')

    paramName: string

    The name of the parameter extracted from this segment, if any

    staticChildren: NullProtoObj<Node<Data, any, any>> = ...

    Direct child nodes with static names

    store: Endpoint extends true ? Data : unknown

    The data stored in this node if it's an endpoint

    type: NodeType

    The classification of this node (Static, Dynamic, CatchAll, etc.)

    wildcardChild: Node<Data, any, any> | null = null

    Child node for wildcard segments (e.g., '*')

    Methods

    • Adds a child node to this node.

      Parameters

      • child: Node<Data, string, boolean>

        The node to add as a child.

      Returns void

    • Derives the NodeType and extracted parameter name from a raw path segment.

      Supported segment syntaxes:

      • :id → Dynamic (paramName: 'id')
      • * → Wildcard (paramName: '*')
      • [id] → Dynamic (paramName: 'id')
      • [...id] → CatchAll (paramName: 'id')
      • [[...id]] → OptionalCatchAll (paramName: 'id')
      • Otherwise → Static (paramName: '')

      Parameters

      • segment: string

        The raw segment string to analyze.

      Returns { paramName: string; type: NodeType }

      An object containing the derived type and parameter name.