Class Left<L, R>

Represents the left side of an Either type. Left

Implements

Type Parameters

  • L

    The type of the left side.

  • R

    The type of the right side.

Implements

Constructors

Properties

Methods

Constructors

  • Private

    Private constructor to create an instance of Left.

    Type Parameters

    • L
    • R

    Parameters

    • val: L

      The value on the left side.

    Returns Left<L, R>

Properties

val: L

The value on the left side.

Methods

  • Checks if the Either instance is on the left side.

    Returns boolean

    True if the instance is on the left side, otherwise false.

  • Checks if the Either instance is on the right side.

    Returns boolean

    True if the instance is on the right side, otherwise false.

  • Applies a function to the value inside the Either instance if it is on the left side, returning a new Either instance containing the result of the function. If the Either is on the right side, it returns itself.

    Type Parameters

    • T

    Parameters

    • fn: ((value) => T)

      A function to transform the value on the left side.

        • (value): T
        • Parameters

          • value: L

          Returns T

    Returns Either<T, R>

    An Either instance representing the transformed left side.

  • Applies a function to the value inside the Either instance if it is on the right side, returning a new Either instance containing the result of the function. If the Either is on the left side, it returns itself.

    Type Parameters

    • T

    Parameters

    • fn: ((value) => T)

      A function to transform the value on the right side.

        • (value): T
        • Parameters

          • value: R

          Returns T

    Returns Either<L, T>

    An Either instance representing the transformed right side.

  • Unwraps the value contained in the Either instance.

    Returns L

    The value contained in the Either instance.

  • Static method to create an instance of Right.

    Type Parameters

    • L

      The type of the left side.

    • R

      The type of the right side.

    Parameters

    • value: L

      The value on the left side.

    Returns Either<L, R>

    An instance of Left.

Generated using TypeDoc