Skip to content

Commit

Permalink
Fix exporting class instead of factory for ParallelTransformStream
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocasciaro committed May 8, 2014
1 parent 2d09581 commit 2e0604e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ Emitted: 3

#### throughParallel([options], [transform], [flush])

* `options`: Options to pass to the `Transform` stream plus one specific option:
* `options`: Options to pass to the [`Transform`](http://nodejs.org/api/stream.html#stream_new_stream_transform_options) stream plus one specific option:
* `concurrency`: defaults to `2` and specifies how many tasks can run in parallel
* `transform`: the `_transform` function
* `flush`: the `_flush` function
* `transform`: the [`_transform`](http://nodejs.org/api/stream.html#stream_transform_transform_chunk_encoding_callback) function.
* `flush`: the [`_flush`](http://nodejs.org/api/stream.html#stream_transform_flush_callback) function.

#### throughParallel.obj([options], [transform], [flush])

Expand Down
14 changes: 6 additions & 8 deletions parallelTransformStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ ParallelTransformStream.prototype._createCallback =
function _createCallback(item) {
var self = this;
return function(err, chunk) {
if(chunk) {
item.chunks.push(chunk);
}
item.completed = true;

if(err) {
self.emit('error', err);
item.chunks = [];
} else {
if (chunk) {
item.chunks.push(chunk);
}
}
item.completed = true;
self._drainBuffer();
};
};
Expand Down Expand Up @@ -92,7 +92,5 @@ ParallelTransformStream.prototype._flush =
}
};

module.exports = function(transform, concurrency) {
return new ParallelTransformStream(transform, concurrency);
};
module.exports = ParallelTransformStream;

0 comments on commit 2e0604e

Please sign in to comment.