Created
January 26, 2019 22:01
-
-
Save rasmusvhansen/4ac4cb33436f0ca4b6e62b763bcd5642 to your computer and use it in GitHub Desktop.
RxJS Transducer Usage
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 { transducer } from 'rxjs-transducer'; | |
const result = transducer([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])( | |
map(n => n * 2), | |
filter(n => n > 4), | |
map(n => ' Num: ' + n), | |
reduce((acc, str) => acc + str, 'Start:') | |
); | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment