You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.
If the mapper function is asynchronous, the output stream is not guaranteed to have the same order as the input stream. This violates the semantics of "map".
Here is a test to illustrate the problem:
exports ['stream comes back in the correct order'] = function (test) {
var input = [3, 2, 1]
var delayer = map(function(data, cb){
setTimeout(function () {
cb(null, data)
}, 100 * data)
})
readStream(delayer, function (err, output) {
it(output).deepEqual(input)
test.done()
})
writeArray(input, delayer)
}
And the resulting error:
test/
stream comes back in the correct order
AssertionError: [1,2,3] deepEqual [3,2,1]
The text was updated successfully, but these errors were encountered:
When I need this functionality, i use this https://github.com/dominictarr/pull-paramap
because pull-streams are simpler than node streams (for streams of objects) and handle back pressure better.
@parshap it's really easy to make a thing that does that with https://github.com/dominictarr/through
it should be a separate module, if you write it, I'll link it from the map-stream readme.
parshap
added a commit
to parshap/portfolio
that referenced
this issue
Nov 22, 2013
If the mapper function is asynchronous, the output stream is not guaranteed to have the same order as the input stream. This violates the semantics of "map".
Here is a test to illustrate the problem:
And the resulting error:
The text was updated successfully, but these errors were encountered: