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 functions.
Go to Latest
method O.unwrapOr
import { O } from "https://deno.land/x/ahh@v0.10.3/src/option/mod.ts";

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

Examples

Example 1

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