Created
March 15, 2018 22:04
-
-
Save fabriciofmsilva/5d1aac83923634937d1aff072b0108f1 to your computer and use it in GitHub Desktop.
Pipeable operators | RxJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { range } from 'rxjs/observable/range'; | |
import { map, filter, scan } from 'rxjs/operators'; | |
const source$ = range(0, 10); | |
source$.pipe( | |
filter(x => x % 2 === 0), | |
map(x => x + x), | |
scan((acc, x) => acc + x, 0) | |
) | |
.subscribe(x => console.log(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment