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

x/ahh/src/option.ts

Opinionated idiomatic features for TypeScript.
Go to Latest
import * as ahh from "https://deno.land/x/ahh@v0.13.0/src/option.ts";

An optional value.

The Option type defined here is nothing special, it's the same as what the rest of the ecosystem already uses. Thanks to this, we still benefit from the built-in language features for nullish types, such as:

Functions

Returns whether option is a None value.

Returns whether option is a Some value.

Returns the result of fn appied to the value of option, if it is a Some.

Returns the values of option as a tuple of Options.

Returns the values of option and other as a tuple if both are Somes.

Type Aliases

A value that is [nullish]; either undefined or null.

A value that is either None or Some.

A value that is non-[nullish].