Hullo JS
Search…
|> map
import { map } from '@hullo/core'
Use this operator to transform messages coming through a source Observable. Transforming function gets a message as an argument and should return a value to be sent through resulting Observable.
1
import { new Observable, map } from '@hullo/core';
2
​
3
new Observable(observer => {
4
observer.next(Math.round(Math.random() * 100));
5
})
6
.pipe(map(n => n * 2))
7
.subscribe({
8
next: v => { console.log(v, 'is an even number') }
9
});
Copied!
Last modified 2yr ago
Copy link