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

7 lines (6 loc) 275 B
import { type Result } from '../core/result.js'; /** * Unwraps a result _input_, returns the content of an `Ok(T)`. * If the value is an `Err(E)` then return _defaultValue_. */ export declare function unwrapOrForResult<T>(input: Result<T, unknown>, defaultValue: T): T;