The [Stream documentation for .push](http://nodejs.org/api/stream.html#stream_readable_push_chunk_encoding)
explicitly states multiple times that null is a special cased value
that indicates the end of a stream. It is confusing and undocumented
that undefined *also* ends the stream, even though in object mode
there is a distinct and important difference.
The docs for Object-Mode also explicitly mention null as the *only*
special cased value, making no mention of undefined.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
var er = chunkInvalid(state, chunk);
if (er) {
stream.emit('error', er);
- } else if (util.isNullOrUndefined(chunk)) {
+ } else if (chunk === null) {
state.reading = false;
if (!state.ended)
onEofChunk(stream, state);
test._read = function(size) {
var chunk = chunks[n++];
setTimeout(function() {
- test.push(chunk);
+ test.push(chunk === undefined ? null : chunk);
});
};