Function fromOptional

  • Either constructor from optional value

    Resolves to 'left error' in case of undefined value and 'right value' otherwise

    Type Parameters

    • L

    Parameters

    • value: undefined

      possibly undefined value

    • error: L

      error to use in case of undefined value

    Returns Left<never, L>

    either 'right value' or 'left error'

  • Type Parameters

    • R

    Parameters

    • value: Exclude<R, undefined>
    • error: unknown

    Returns Right<R, never>

  • Type Parameters

    • R

    • L

    Parameters

    • value: undefined | R
    • error: L

    Returns Either<R, L>

Generated using TypeDoc