Skip to content

Instantly share code, notes, and snippets.

@rasmusvhansen
Created January 26, 2019 22:06
Show Gist options
  • Save rasmusvhansen/7334b90c5f32f9ea0925d28a73e4f6cf to your computer and use it in GitHub Desktop.
Save rasmusvhansen/7334b90c5f32f9ea0925d28a73e4f6cf to your computer and use it in GitHub Desktop.
Infinite RxJS transducer
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