Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/monads/mod.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/mod.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>