-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transduce transform. Resolves #212. #223
Conversation
Nice! Might be useful to have a test for a transducer that terminates early like var isEven = function(n) { return n % 2 == 0; };
var xf = transducers.comp(transducers.takeWhile(function(n) { return n < 5; }), transducers.filter(isEven));
_([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).transduce(xf).toArray(function (xs) {
test.same(xs, [2, 4])
}); |
Done. The test just uses a |
Note to self: Rebase onto master before merging. |
Since there's no more outstanding comments, I'll go ahead and merge this. |
Add transduce transform. Resolves #212.
This is fantastic, fair play for all the work you've done lately not just on this particular PR. |
Docs adapted from @kevinbeaty's suggestion, but with the parts about resuming streams stripped out, since no transform resumes streams.
Error handling:
step
orresult
throws, then the transformation stops and the error (andnil
) is pushed. This matches the behavior ofreduce
andscan
.