Skip to main content
Module

x/monads/index.ts>Either

👻 Option, Result, and Either types for TypeScript; Inspired by Rust
Latest
interface Either
import { type Either } from "https://deno.land/x/monads@v0.5.10/index.ts";

Properties

type: symbol

Methods

isLeft(): boolean
isRight(): boolean
left(): Option<L>
leftAndThen<U>(fn: (val: L) => Either<U, R>): Either<U, R>
right(): Option<R>
rightAndThen<U>(fn: (val: R) => Either<L, U>): Either<L, U>
unwrap(): L | R
unwrapLeft(): L | never
unwrapLeftOr(other: L): L
unwrapLeftOrElse(fn: (right: R) => L): L
unwrapRight(): R | never
unwrapRightOr(other: R): R
unwrapRightOrElse(fn: (left: L) => R): R
match<U>(fn: Match<L, R, U>): U
map<U>(fn: (val: L | R) => U): Either<U, U>
mapLeft<U>(fn: (left: L) => U): Either<U, R>
mapRight<U>(fn: (right: R) => U): Either<L, U>