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>`.
11 lines (10 loc) • 455 B
TypeScript
import type { AsyncFilterFn } from '../internal/function.js';
import { type Maybe } from './maybe.js';
/**
* Returns `undefined` if the _input_ is `null` or `undefined`,
* otherwise calls _predicate_ with the value `T` and returns:
*
* * `T` if _predicate_ returns `true`.
* * `undefined` if _predicate_ returns `false`.
*/
export declare function filterAsyncForMaybe<T>(input: Maybe<T>, predicate: AsyncFilterFn<T>): Promise<Maybe<T>>;