Skip to content

Instantly share code, notes, and snippets.

@rasmusvhansen
Created January 26, 2019 22:01
Show Gist options
  • Save rasmusvhansen/4ac4cb33436f0ca4b6e62b763bcd5642 to your computer and use it in GitHub Desktop.
Save rasmusvhansen/4ac4cb33436f0ca4b6e62b763bcd5642 to your computer and use it in GitHub Desktop.
RxJS Transducer Usage
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