Skip to main content
Module

x/rimbu/mod.ts>AsyncOptLazy.toMaybePromise

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function AsyncOptLazy.toMaybePromise
import { AsyncOptLazy } from "https://deno.land/x/rimbu@0.14.0/mod.ts";
const { toMaybePromise } = AsyncOptLazy;

Returns the value or promised value contained in an AsyncOptLazy instance of type T.

Examples

Example 1

AsyncOptLazy.toMaybePromise(1)              // => 1
AsyncOptLazy.toMaybePromise(() => 1)        // => 1
AsyncOptLazy.toMaybePromise(() => () => 1)  // => () => 1
AsyncOptLazy.toMaybePromise(async () => 1)  // => Promise(1)
AsyncOptLazy.toMaybePromise(Promise.resolve(1))  // => Promise(1)

Parameters

optLazy: AsyncOptLazy<T>
  • the AsyncOptLazy value of type T