Function capture

  • capture is the only way to create a capture. Given a parser and a name, capture runs the parser and saves its result in a captures object with the given name as the key. It returns the result from the parser, and attaches the captures object along with it.

    Type Parameters

    • T
    • const S extends string

    Parameters

    • parser: Parser<T>

      parser to run

    • name: S

      name of the capture

    Returns CaptureParser<T, Record<S, T>>

    • the results of the parser, with the captures object attached.

Generated using TypeDoc