Function reason

  • Applies the source parser, modifying the failure reason to the given message if it fails Softly. Useful for providing the user with a more meaningful error message than was is provided by default.

    Type Parameters

    • T

    Parameters

    • message: string

      The new message.

    Returns ParjsCombinator<T, T>

  • Applies the source parser. If it fails, calls onFailure with the failure info and uses the returned string as the new failure reason.

    Type Parameters

    • T

    Parameters

    • onFailure: ((failure) => string)

      A function that takes the failure info and returns the new reason.

        • (failure): string
        • Parameters

          Returns string

    Returns ParjsCombinator<T, T>