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

x/ahh/mod.ts>O.unwrapOr

Idiomatic type-safety structures for TypeScript.
Go to Latest
method O.unwrapOr
Re-export
import { O } from "https://deno.land/x/ahh@v0.10.0/mod.ts";

Returns opt if it is a Some, or returns default_.

Examples

import { O, None } from "./mod.ts";

console.log(O.unwrapOr(1, 2)); // 1
console.log(O.unwrapOr(None, 2)); // 2

Parameters

opt: Option<T>
default_: T