Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/gauntlet/imports/tmonad.ts>Option

Work-in-progress front-end tool which does put a smile on my face
Latest
interface Option
import { type Option } from "https://deno.land/x/gauntlet@v0.0.9/imports/tmonad.ts";

Properties

type: OptionType

Option type

Methods

isSome(): boolean

Check if option is some

isNone(): boolean

Check if option is none

map<R>(f: (wrapped: T) => R): Option<R>

Map

flatMap<R>(f: (wrapped: T) => Option<R>): Option<R>

Flatmap

match<U>(fn: Match<T, U>): Option<U>

Match

flatMatch<U>(fn: FlatMatch<T, U>): Option<U>

FlatMatch

run<U>(gen: Generator<Option<T> | undefined, Option<U>, T>): Option<U>

Run using generator

getOrElse<R>(defaultValue: R): T | R

Get the value from option, but if it's null, return the defaultValue

extract(): T | null

Get the value from option