filter<T> function
Using the given predicate
, conditionally convert the Option to a None.
expect(
some('hello').chain(filter((s) => s == 'hello')),
some('hello'),
);
expect(
some('asdf').chain(filter((s) => s == 'hello')),
none(),
);
Implementation
Option<T> Function(Option<T> option) filter<T>(
bool Function(T value) predicate,
) =>
flatMap(fromPredicateK(predicate));