Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ahh/mod.ts>O.okOr

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

Converts opt into an Ok if it is a Some.

Examples

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

console.log(O.okOr(1, Error())); // 1
console.log(O.okOr(None, Error())); // Error()

Type Parameters

T
E extends Error

Parameters

opt: Option<T>
err: E