Class Right<L, R>

Represents the right side of an Either type. Right

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 Right.

    Type Parameters

    • L
    • R

    Parameters

    • val: R

      The value on the right side.

    Returns Right<L, R>

Properties

val: R

The value on the right 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 R

    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: R

      The value on the right side.

    Returns Either<L, R>

    An instance of Right.

Generated using TypeDoc