How to use the filter function from rxjs

Find comprehensive JavaScript rxjs.filter code examples handpicked from public code repositorys.

16
17
18
19
20
21
22
23
24
    return execute$(
        'python3',
        'get band names',
        [`${__dirname}/gdal/get_band_names.py`, path]
    ).pipe(
        filter(({stream}) => stream === 'stdout'),
        map(({value}) => JSON.parse(value))
    )
})
fork icon45
star icon180
watch icon34

31
32
33
34
35
36
37
38
39
40
unlock$.pipe(
    tap(instance => instance.locked = false),
    mergeMap(instance =>
        timer(maxIdleMilliseconds).pipe(
            takeUntil(lock$.pipe(
                filter(currentInstance => currentInstance === instance)
            )),
            map(() => instance)
        )
    )
fork icon45
star icon178
watch icon34

16
17
18
19
20
21
22
23
24
25
26
    })


const apps$ = () =>
    fileToJson$('/var/lib/sepal/app-manager/apps.json').pipe(
        switchMap(({apps}) => from(apps)),
        filter(({repository}) => repository),
        map(({endpoint = 'shiny', label, repository, branch}) => {
            const name = basename(repository)
            return {
                endpoint,
fork icon45
star icon177
watch icon0

90
91
92
93
94
95
96
97
98
99
100


task$.pipe(
    mergeMap(task => {
        const taskCancellation$ = merge(
            cancel$.pipe(
                filter(id => id === task.id),
                tap(() => log.debug(msg(task.id, 'cancelled by user'))),
            ),
            switchedToServiceAccount$.pipe(
                tap(() => log.debug(msg(task.id, 'cancelled by switching to service account'))),
fork icon45
star icon177
watch icon0

59
60
61
62
63
64
65
66
67
68
ctx.response.status = 200;

listener.open().then(() => {
  console.log('listener open');
  listener.confirmed(bot.address).pipe(
    op.filter(tx => {
      console.log(tx);
      return tx.transactionInfo !== undefined && tx.transactionInfo.hash === signedLockTx.hash;
    }),
    op.delay(5000),
fork icon5
star icon5
watch icon3

32
33
34
35
36
37
38
39
40
41
}
statistics.collectExperimentMetadata(parameters)

const experiment = {
  busStops: regions.pipe(
    filter((region) => region.stops),
    mergeMap((region) => region.stops)
  ),
  lineShapes: regions.pipe(
    filter((region) => region.lineShapes),
fork icon1
star icon16
watch icon0

+ 8 other calls in file

73
74
75
76
77
78
79
80
81
82
        delayWhen((_) => timer(RECONNECT_INTERVAL))
      ),
  })
);
const binance = subjectBinance.pipe(
  filter((y) => y.s.slice(0, -4) === x),
  map((z) => ({ market: z.s, price: Number(z.c) })),
  repeat({
    delay: (x) =>
      of(x).pipe(
fork icon2
star icon0
watch icon0

+ 3 other calls in file

18
19
20
21
22
23
24
25
26
27
28
29
  })




range(10, 3)
  .pipe(
    // filter(n => n % 2 === 0),
    // take(5),
  )
  .subscribe(console.log)
 
fork icon0
star icon0
watch icon1

+ 3 other calls in file