jlongster / transducers.js

A small library for generalized transformation of data (inspired by Clojure's transducers)
BSD 2-Clause "Simplified" License
1.72k stars 54 forks source link

transduce function doesn't support reducer parameter of function type #40

Open milosh86 opened 9 years ago

milosh86 commented 9 years ago

Hi, Currently, transduce doesn't allow reducer parameter to be regular function.

For example:

var add = (a, b) => a + b;
t.transduce([1,2,3,4], t.map(x => x), add, 0); // doesn't work
t.transduce([1,2,3,4], t.map(x => x), t.transformer(add), 0); // ok

Is there any reason not to put transformer part inside transduce fn?