Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/ahh/src/option/mod.ts>O.unwrapOr

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

Returns the contained Some value or the provided default.

Examples

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

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

Parameters

o: Option<T>
default_: T