jlongster / transducers.js

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

use iter interface in transducers when passed with a collection #1

Closed jlongster closed 9 years ago

jlongster commented 9 years ago

Currently if a transducer like map is passed a collection it eagerly performs the transformation. It checks if it's an array to do a fast while loop and otherwise uses reduce to get the generic interface. This is stupid; transducers that eagerly do transformation should just use the iterator interface directly to implement the transform.

This will reduce a lot of code bloat.