• This overload makes a new Matcher that transforms the matched value from a given Matcher.

    Use map1 if some matched values can't be mapped.

    Use ab to map over values of two consecutive parsers.

    Use abc to map over values of three consecutive parsers.

    Type Parameters

    • TToken

    • TOptions

    • TValue1

    • TValue2

    Parameters

    • p: Matcher<TToken, TOptions, TValue1>

      A base matcher.

    • mapper: ((v: TValue1, data: Data<TToken, TOptions>, i: number, j: number) => TValue2)

      A function that modifies the matched value.

        • (v: TValue1, data: Data<TToken, TOptions>, i: number, j: number): TValue2
        • Parameters

          • v: TValue1

            A value matched by 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).

          • j: number

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

          Returns TValue2

    Returns Matcher<TToken, TOptions, TValue2>

  • Make a new parser that transforms the matched value from a given parser.

    Use map1 if some matched values can't be mapped.

    Type Parameters

    • TToken

    • TOptions

    • TValue1

    • TValue2

    Parameters

    • p: Parser<TToken, TOptions, TValue1>

      A base parser.

    • mapper: ((v: TValue1, data: Data<TToken, TOptions>, i: number, j: number) => TValue2)

      A function that modifies the matched value.

        • (v: TValue1, data: Data<TToken, TOptions>, i: number, j: number): TValue2
        • Parameters

          • v: TValue1

            A value matched by 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).

          • j: number

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

          Returns TValue2

    Returns Parser<TToken, TOptions, TValue2>

Generated using TypeDoc