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) • 469 B
TypeScript
import type { FilterFn } from '../../internal/function.js';
import { type Option } from './option.js';
/**
* Returns `None` if the option is `None`,
* otherwise the result should be resolved by the result of _predicate_ with the wrapped value as the arguments:
*
* * `Some(t)` if _predicate_ returns `true`.
* * `None` if _predicate_ returns `false`.
*/
export declare function filterForOption<T>(input: Option<T>, predicate: FilterFn<T>): Option<T>;