rx-filternil
v1.0.2
Published
A utility function that filters out null and undefined values from RxJS streams or arrays.
Downloads
163
Maintainers
Readme
FilterNil
A utility function for filtering out null
and undefined
values from RxJS streams or arrays.
Installation
Install via npm:
npm install rx-filternil
Usage
filterNil
is a function that removes null
and undefined
values from a data stream or array using RxJS operators.
Example
import { of } from 'rxjs';
import { filterNil } from 'rx-filternil';
of(null, 1, undefined, 2, 3)
.pipe(filterNil())
.subscribe(console.log); // Outputs: 1, 2, 3
API
filterNil
A function that filters out null
and undefined
values. This function can be used in any RxJS pipeline to clean up data streams.
- Returns:
Function
- A function that filters outnull
andundefined
values.
Testing
To run tests using Brittle:
npm test
License
This project is licensed under the MIT License.