filter()
Function
filter<T>(filterFn:
Function
):CancellingPipeOperator
<T
,T
>
Prevents emission of a value in the observable chain, if the value does not pass the test in the filterFn.
ts
declare const read1: Read<string>;
const read: Read<string, true> = read1.pipe(filter((value: string) => value !== 'allowed'));
Using this operator in a chain, results in the resulting Read to be a cancelling Read.
Observable Behavior:
Works exactly like filter of RxJS.
Sync Behavior:
Checks the value with the filterFn. If it passes the check the chain will continue, if not it will be canceled.
Source: rxjs-read/src/lib/operators/filter.operator.ts:28
Type parameters
Parameter | Description |
---|---|
T | type of the value |
Parameters
Parameter | Type | Description |
---|---|---|
filterFn | (value: T ) => boolean | function used for filtering |
Returns
CancellingPipeOperator
<T
, T
>