Skip to main content
Module

x/monads/index.ts>Result

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

Properties

type: symbol

Methods

isOk(): boolean
isErr(): boolean
ok(): Option<T>
err(): Option<E>
unwrap(): T | never
unwrapOr(optb: T): T
unwrapOrElse(fn: (err: E) => T): T
unwrapErr(): E | never
match<U>(fn: Match<T, E, U>): U
map<U>(fn: (val: T) => U): Result<U, E>
mapErr<U>(fn: (err: E) => U): Result<T, U>
andThen<U>(fn: (val: T) => Result<U, E>): Result<U, E>
orElse<U>(fn: (err: E) => Result<U, E>): Result<T, E> | Result<U, E>