UNPKG

option-t

Version:

A toolkit of Nullable/Option/Result type implementation in ECMAScript. Their APIs are inspired by Rust's `Option<T>` and `Result<T, E>`.

9 lines (8 loc) 543 B
import type { AsyncTransformFn, AsyncRecoveryFn } from '../../internal/function.js'; import { type Option } from './option.js'; /** * Maps a `Option<T>` to `U` by applying _transformer_ to a contained `Some(T)` value in _input_, * or a _recoverer_ function to a contained `None` value in _input_. * This function can be used to unpack a successful result while handling an error. */ export declare function mapOrElseAsyncForOption<T, U>(input: Option<T>, recoverer: AsyncRecoveryFn<U>, transformer: AsyncTransformFn<T, U>): Promise<U>;