Created
January 26, 2019 22:06
-
-
Save rasmusvhansen/7334b90c5f32f9ea0925d28a73e4f6cf to your computer and use it in GitHub Desktop.
Infinite RxJS transducer
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
function* integers() { | |
let i = 0; | |
while (true) { | |
yield i++; | |
} | |
} | |
const result = transducer(integers())( | |
skip(10), | |
filter(n => n % 3 === 0), | |
map(i => i * 2), | |
take(5) | |
); | |
console.log(result); // [ 24, 30, 36, 42, 48 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment