method AsyncResult.prototype.unwrapOrElse
AsyncResult.prototype.unwrapOrElse<U>(fn: (error: E) => U): Promise<T | U>

Returns the Ok value or computes a default from the error.

Type Parameters

The type of the default value

Parameters

fn: (error: E) => U

Function to compute the default value from the error

Return Type

Promise<T | U>

Promise of the Ok value or the computed default value

Usage

import { AsyncResult } from "result/mod.ts";