The fluent syntax for Validation.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

The property that discriminates Validation.

Methods

  • Compare this and that Validation to determine their ordering.

    Type Parameters

    • E extends Ord<E>

    • T extends Ord<T>

    Parameters

    Returns Ordering

    Remarks

    When ordered, Err always compares as less than Ok. If the variants are the same, their failures or successes are compared to determine the ordering.

  • Compare this and that Validation to determine their equality.

    Type Parameters

    • E extends Eq<E>

    • T extends Eq<T>

    Parameters

    Returns boolean

    Remarks

    Two Validation are equal if they are the same variant and their failures or successes are equal.

  • Test whether this Validation has failed.

    Type Parameters

    • E

    Parameters

    Returns this is Err<E>

  • Test whether this Validation has succeeded.

    Type Parameters

    • T

    Parameters

    Returns this is Ok<T>

  • If this Validation fails, apply a function to map its failure.

    Type Parameters

    • E

    • T

    • E1

    Parameters

    • this: Validation<E, T>
    • f: ((val) => E1)
        • (val): E1
        • Parameters

          • val: E

          Returns E1

    Returns Validation<E1, T>

  • If this Validation succeeds, apply a function to map its success.

    Type Parameters

    • E

    • T

    • T1

    Parameters

    • this: Validation<E, T>
    • f: ((val) => T1)
        • (val): T1
        • Parameters

          • val: T

          Returns T1

    Returns Validation<E, T1>

  • Apply one of two functions to extract the failure or success out of this Validation, depending on the variant.

    Type Parameters

    • E

    • T

    • T1

    • T2

    Parameters

    • this: Validation<E, T>
    • unwrapErr: ((val) => T1)
        • (val): T1
        • Parameters

          • val: E

          Returns T1

    • unwrapOk: ((val) => T2)
        • (val): T2
        • Parameters

          • val: T

          Returns T2

    Returns T1 | T2

  • If this and that Validation succeed, apply a function to combine their successes.

    Type Parameters

    Parameters

    • this: Validation<E, T>
    • that: Validation<E, T1>
    • f: ((lhs, rhs) => T2)
        • (lhs, rhs): T2
        • Parameters

          • lhs: T
          • rhs: T1

          Returns T2

    Returns Validation<E, T2>

Generated using TypeDoc