Function satisfy

  • Make a parser that tests a token with a given predicate and returns it.

    Use token instead if you want to transform the value.

    Type Parameters

    • TToken

    • TOptions

    Parameters

    • test: ((token: TToken, data: Data<TToken, TOptions>, i: number) => boolean)

      A test condition/predicate.

        • (token: TToken, data: Data<TToken, TOptions>, i: number): boolean
        • Parameters

          • token: TToken

            A token at the parser position.

          • data: Data<TToken, TOptions>

            Data object (tokens and options).

          • i: number

            Parser position in the tokens array (points at the same token).

          Returns boolean

    Returns Parser<TToken, TOptions, TToken>

Generated using TypeDoc