Skip to content

Commit

Permalink
use _final instead of _flush
Browse files Browse the repository at this point in the history
  • Loading branch information
Tapppi committed Jul 19, 2018
1 parent 1b4919b commit 9d5d82d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var ParallelTransform = function(maxParallel, opts, ontransform) {
this._maxParallel = maxParallel;
this._ontransform = ontransform;
this._destroyed = false;
this._flushed = false;
this._finishing = false;
this._ordered = opts.ordered !== false;
this._buffer = this._ordered ? cyclist(maxParallel) : [];
this._top = 0;
Expand Down Expand Up @@ -66,9 +66,9 @@ ParallelTransform.prototype._transform = function(chunk, enc, callback) {
this._ondrain = callback;
};

ParallelTransform.prototype._flush = function(callback) {
this._flushed = true;
this._ondrain = callback;
ParallelTransform.prototype._final = function(callback) {
this._finishing = true;
this.ondrain = callback;
this._drain();
};

Expand Down Expand Up @@ -99,7 +99,7 @@ ParallelTransform.prototype._drain = function() {

ParallelTransform.prototype._drained = function() {
var diff = this._top - this._bottom;
return this._flushed ? !diff : diff < this._maxParallel;
return this._finishing ? !diff : diff < this._maxParallel;
};

module.exports = ParallelTransform;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"dependencies": {
"cyclist": "~0.2.2",
"inherits": "^2.0.3",
"readable-stream": "^2.1.5"
"readable-stream": "^2.3.6"
}
}

0 comments on commit 9d5d82d

Please sign in to comment.