function / @typed/router/Path

parseWithRest

Parses route atoms and returns both AST nodes and unconsumed input.

Package version
1.0.0-beta.13
Category
Path parsing
Since
1.0.0

Import

import { parseWithRest } from "@typed/router/Path";

Signatures

export declare function parseWithRest(input: string): RuntimeParseResult;

Why

The runtime grammar can be embedded while preserving where parsing stopped.

Ownership and lifetime

parseWithRest parses immediately and returns fresh AST array state; it retains neither the input string nor parser cursor.

Examples

import { parseWithRest } from "@typed/router/Path"

const [ast, rest] = parseWithRest("/users/:id?tab=:tab? trailing")

Source