UNPKG

@surface/path-matcher

Version:

Provides path matching capabilities.

22 lines (21 loc) 741 B
import type ContextType from "./context-type.js"; export type Pending = { index: number; rollback: string; }; export declare const last: <T>(elements: T[]) => T | undefined; export default class Context { readonly type: ContextType; private readonly start; readonly tokens: string[]; readonly pending: Pending[]; readonly parent?: Context; readonly children: Context[]; rolledBack: boolean; constructor(type: ContextType, parent?: Context); discard(): void; inside(context: ContextType, depth?: number): boolean; lookup(context: ContextType, depth?: number): Context | null; push(token: string, rollback?: string): void; rollback(recursive?: boolean): void; }