Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify `opts.handleCommon()`.

  • Loading branch information...
commit d42b35c226232c6505a39325958fd6d582b1dda9 1 parent 2a9aafb
Dan Bornstein authored
View
2  lib/blip.js
@@ -123,7 +123,7 @@ function Blip(data, options) {
stream.Stream.call(this);
this.blip = sealer.seal(new State(this, data));
- opts.handleCommon(options, this, true);
+ opts.handleCommon(options, this);
}
util.inherits(Blip, stream.Stream);
View
2  lib/dropper.js
@@ -231,7 +231,7 @@ function Dropper(source, options) {
options = opts.validate(options, OPTIONS);
stream.Stream.call(this);
this.dropper = sealer.seal(new State(this, source, options));
- opts.handleCommon(options, this, false);
+ opts.handleCommon(options, this);
}
util.inherits(Dropper, stream.Stream);
View
12 lib/opts.js
@@ -123,7 +123,7 @@ function validate(options, allowed) {
* Handles the three common options `encoding`, `incomingEncoding`, and
* `paused`.
*/
-function handleCommon(options, target, constructedPaused) {
+function handleCommon(options, target) {
if (options.encoding) {
target.setEncoding(options.encoding);
}
@@ -132,14 +132,8 @@ function handleCommon(options, target, constructedPaused) {
target.setIncomingEncoding(options.incomingEncoding);
}
- if (typ.isDefined(options.paused)) {
- if (options.paused) {
- if (!constructedPaused) {
- target.pause();
- }
- } else if (constructedPaused) {
- target.resume();
- }
+ if (options.paused) {
+ target.pause();
}
}
View
2  lib/pipe.js
@@ -245,7 +245,7 @@ function Pipe(options) {
// The options all apply to the reader.
options = opts.validate(options, OPTIONS);
- opts.handleCommon(options, this.reader, false);
+ opts.handleCommon(options, this.reader);
}
View
2  lib/sink.js
@@ -259,7 +259,7 @@ function Sink(source, options) {
options = opts.validate(options, OPTIONS);
stream.Stream.call(this);
this.sink = sealer.seal(new State(this, source));
- opts.handleCommon(options, this, false);
+ opts.handleCommon(options, this);
}
util.inherits(Sink, stream.Stream);
Please sign in to comment.
Something went wrong with that request. Please try again.