2.0-alpha Menu

map vs filter

Project vs Predicate

In this example, ▬ isEven accepts a number as an argument, then:

  • If it is an even number, it returns ✔ true
  • Otherwise, it returns ✘ false

It is used as:

  • a project function on the ❚ map card
  • a predicate function on the ❚ filter card

A predicate returns ✔ true or ✘ false.


This is how ❚ map works with a project function:

  • It waits for events from an input stream
  • It projects each event of this input stream with the project function
  • As a result, it returns a new stream of projected events


This is how ❚ filter works with a predicate:

  • Each event of the input stream is given to the predicate
  • If the predicate returns ✔ true, the event can pass
  • Otherwise, the event is ignored
  • As a result, it returns a new stream of filtered values


merge vs combineLatest

See also

project vs predicate

💌 I create something new each week!
Learn Reactive Programming and stay tuned.

Occasional updates, plus:

Cédric Soulas - Freelance Developer Advocate. Learn more.

Follow 👨‍💻 Hire me