Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit 5a82490

Browse files
committed
fix(parallel-transform): properly set default maxParallel
1 parent bd742a6 commit 5a82490

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/parallel-transform.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@ export default class ParallelTransform extends stream.Transform {
2020
* to the `stream.Transform` constructor
2121
**/
2222
constructor(options = {}) {
23-
const defaultOptions = {
24-
highWaterMark: Math.max(options.maxParallel, 16),
25-
maxParallel: 5
26-
};
23+
const maxParallel = options.maxParallel || 5,
24+
defaultOptions = {
25+
maxParallel,
26+
highWaterMark: Math.max(maxParallel, 16)
27+
};
2728

2829
super(Object.assign({}, defaultOptions, options));
2930

3031
// set default properties
31-
_maxParallel.set(this, options.maxParallel);
32+
_maxParallel.set(this, maxParallel);
3233
_destroyed.set(this, false);
3334
_flushed.set(this, false);
34-
_buffer.set(this, cyclist(options.maxParallel));
35+
_buffer.set(this, cyclist(maxParallel));
3536
_top.set(this, 0);
3637
_bottom.set(this, 0);
3738
_ondrain.set(this, null);

0 commit comments

Comments
 (0)