Hullo JS
Github
Chat
Searchβ¦
Hullo JS
Hullo π
Hullo π core
Intro to Core
API
Observable
Duplex
Channel
Atom
Redux
of
combineLatest
timeout
interval
Operators
|> deepMap
|> deepMapByKey
|> distinct
|> filter
|> flatMap
|> map
|> merge
|> scan
|> state
|> subject
|> switchMap
Hullo π browser
Intro to Browser
API
Hullo π DOM
Intro to DOM
Guide
API
Hullo π Node
Intro to Node
API
Powered By
GitBook
|> 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!
Previous
|> distinct
Next
|> flatMap
Last modified
3yr ago
Copy link