Hullo JS
Search…
|> filter
import { filter } from '@hullo/core'
Use this operator to drop some messages coming through a source Observable. Filtering function gets a message as an argument and should return a boolean indicating if the message should be passed on (true) or dropped (false).
1
import { Observable, filter } from '@hullo/core';
2
​
3
new Observable(observer => {
4
observer.next(Math.round(Math.random() * 100));
5
})
6
.pipe(filter(n => (n % 2 === 0)))
7
.subscribe({
8
next: v => { console.log(v, 'is an even number') }
9
});
Copied!
Last modified 2yr ago
Copy link