filterNil
Import
Section titled “Import”import { filterNil } from 'ngxtension/filter-nil';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
Section titled “Examples”Example 1: Removing Undefined and Null Values
Section titled “Example 1: Removing Undefined and Null Values”const source$ = of(undefined, null, 1, 2, null);const filtered$ = source$.pipe(filterNil());// Output: 1, 2Inputs
Section titled “Inputs”No inputs needed for this operator.