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.or

Idiomatic type-safety functions.
Go to Latest
method O.or
import { O } from "https://deno.land/x/ahh@v0.10.1/src/option/mod.ts";

Return opt if it is a Some, or other.

Examples

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

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

Parameters

opt: Option<T>
other: Option<T>