map

accepts 1 input stream, a project function

  • When the input stream emits a value, it is given to the project function and the resulting value is emitted

returns a new stream of projected values

Published on Monday, 25 Sept. 2017
Revised on Monday, 8 Oct. 2018

Notes

❚ map and all the other reactive programming functions will never modify the input stream. Instead, they return a new stream. This principle is called immutability.

In the video example, ▬ isChecked is used as a project function. This function accepts events from checkable elements: checkboxes, radio buttons, options of a menu, toggles, etc. It returns ✔ true if the element is checked, ✘ false otherwise.

When an action is performed on the toggle (on→off or off→on), a toggle event is emitted (read a stream of toggle events).

See also


The Illustrated Book of RxJS

Cédric Soulas Follow Hire me

Freelance Developer Advocate. Motion graphics with code. JavaScript and Elm. cedricsoulas.com

Subscribe to reactive.how newsletter

Join the Newsletter

Learn Reactive Programming and stay up-to-date:

Receive my latest news, product updates and programming visualizations. You can unsubscribe at any time.

Highlights

@CedricSoulas

Making an illustrated book!

The Illustrated Book of RxJS

Learn more →