Go ProSign in

This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Add the Transducer Protocol to Support Arbitrary Data Types as our Target Collections

Our helpers are now powerful enough to work with any data type as the source, but they can only build up arrays or objects as the target. For an arbitrary collection type, we thus have to fall back to our transduce function and manually specify the inner reducer behavior based on the API of our target collection.

In this lesson, we'll add support for the transducer protocol, and see how it enables us to transduce into any collection type without having to fall back to using transduce. We'll use the List type from Immutable.JS as our example.

You must be a Member to view code