• This overload adds a side effect to a Matcher without changing it's result.

    Use action if there is nothing to wrap and you need a non-consuming parser instead.

    Type Parameters

    • TToken

    • TOptions

    • TValue

    Parameters

    • p: Matcher<TToken, TOptions, TValue>

      A matcher.

    • f: ((r: Match<TValue>, data: Data<TToken, TOptions>, i: number) => void)

      A function to produce a side effect (logging, etc).

        • (r: Match<TValue>, data: Data<TToken, TOptions>, i: number): void
        • Parameters

          • r: Match<TValue>

            A Result object after running the base parser.

          • data: Data<TToken, TOptions>

            Data object (tokens and options).

          • i: number

            Parser position in the tokens array (before the first parser matched).

          Returns void

    Returns Matcher<TToken, TOptions, TValue>

  • Add a side effect to a parser without changing it's result.

    Use action if there is nothing to wrap and you need a non-consuming parser instead.

    Type Parameters

    • TToken

    • TOptions

    • TValue

    Parameters

    • p: Parser<TToken, TOptions, TValue>

      A parser.

    • f: ((r: Result<TValue>, data: Data<TToken, TOptions>, i: number) => void)

      A function to produce a side effect (logging, etc).

        • (r: Result<TValue>, data: Data<TToken, TOptions>, i: number): void
        • Parameters

          • r: Result<TValue>

            A Result object after running the base parser.

          • data: Data<TToken, TOptions>

            Data object (tokens and options).

          • i: number

            Parser position in the tokens array (before the first parser matched).

          Returns void

    Returns Parser<TToken, TOptions, TValue>

Generated using TypeDoc