filterNil
Import
import { filterNil } from 'ngxtension/filter-nil';Usage
Basic
Filter out undefined and null values from an Observable stream.
import { of } from 'rxjs';import { filterNil } from 'ngxtension/filter-nil';
const source$ = of(undefined, null, 1, undefined);const filtered$ = source$.pipe(filterNil());Examples
Example 1: Removing Undefined and Null Values
const source$ = of(undefined, null, 1, 2, null);const filtered$ = source$.pipe(filterNil());// Output: 1, 2API
Inputs
No inputs needed for this operator.