Comparing version 1.1.0 to 1.2.0
29
index.js
@@ -5,2 +5,4 @@ var eos = require('end-of-stream') | ||
var noop = function() {} | ||
var onclose = function(self) { | ||
@@ -16,2 +18,3 @@ return function(err) { | ||
this.destroyed = false | ||
this._destroy = !opts || opts.destroy !== false | ||
@@ -71,3 +74,3 @@ this._writable = null | ||
if (writable === null) { | ||
stream.Writable.prototype.end.call(this) | ||
this._finish(noop) | ||
return | ||
@@ -103,4 +106,6 @@ } | ||
if (this._readable && this._readable.destroy) this._readable.destroy() | ||
if (this._writable && this._writable.destroy) this._writable.destroy() | ||
if (this._destroy) { | ||
if (this._readable && this._readable.destroy) this._readable.destroy() | ||
if (this._writable && this._writable.destroy) this._writable.destroy() | ||
} | ||
@@ -115,2 +120,11 @@ this.emit('close') | ||
Duplexify.prototype._finish = function() { | ||
var self = this | ||
var end = function() { | ||
stream.Writable.prototype.end.call(self) | ||
} | ||
if (!this.emit('prefinish', end)) end() | ||
} | ||
Duplexify.prototype._forward = function() { | ||
@@ -147,3 +161,3 @@ if (this._forwarding || !this._readable2 || !this._drained) return | ||
var end = function() { | ||
stream.Writable.prototype.end.call(self, cb) | ||
self._finish(cb) | ||
} | ||
@@ -176,4 +190,7 @@ | ||
module.exports.obj = function(writable, readable) { | ||
return new Duplexify(writable, readable, {objectMode:true, highWaterMark:16}) | ||
module.exports.obj = function(writable, readable, opts) { | ||
if (!opts) opts = {} | ||
opts.objectMode = true | ||
opts.highWaterMark = 16 | ||
return new Duplexify(writable, readable, opts) | ||
} |
{ | ||
"name": "duplexify", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Turn a writeable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10691
283