findObservablePipe
Alternative: find$$$
Inlined: findObservable
, find$$
Types
function findObservablePipe<GValue>(
condition: IFindObservablePipeConditionFunction<GValue>,
): IObservablePipe<GValue, GValue>
interface IFindObservablePipeConditionFunction<GValue> {
(value: GValue): boolean;
}
Definition
This pipe emits only the first value emitted by the source Observable that passes condition
(if condition
returns true).
The RxJS equivalent is find.
Diagram
Example
Emit only the first value greater than 2
const subscribe = pipe$$(of(1, 2, 3, 4), [
find$$$<number>(x => x > 2),
]);
subscribe((value: number) => {
console.log(value);
});
Output:
3