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>`.
10 lines (9 loc) • 440 B
TypeScript
import type { TransformFn } from '../../internal/function.js';
import { type Option } from './option.js';
/**
* Maps a `Option<T>` to `Option<U>` by applying a _transformer_ function
* to an contained `Some(T)` value, leaving an `None` value untouched.
*
* This function can be used to compose the results of two functions.
*/
export declare function mapForOption<T, U>(input: Option<T>, transformer: TransformFn<T, U>): Option<U>;