@graphy/core.iso.stream
Advanced tools
Comparing version 3.1.0 to 3.1.1
68
main.js
@@ -396,37 +396,43 @@ const stream = require('stream'); | ||
// node.js | ||
if(b_is_node) { | ||
// patch for node < v10 | ||
if((+(/^v(\d+)/.exec(process.version)[1])) < 10) { | ||
// override destroy methods | ||
Transform.prototype.destroy = Duplex.prototype.destroy = function(e_destroy, fke_destroy) { | ||
this._readableState.destroyed = true; | ||
this._writableState.destroyed = true; | ||
// deduce the runtime environment | ||
const [B_BROWSER, B_BROWSERIFY] = (() => 'undefined' === typeof process | ||
? [true, false] | ||
: (process.browser | ||
? [true, true] | ||
: ('undefined' === process.versions || 'undefined' === process.versions.node | ||
? [true, false] | ||
: [false, false])))(); | ||
let f_emit_close = () => { | ||
if(!this._writableState.emitClose) return; | ||
if(!this._readableState.emitClose) return; | ||
this.emit('close'); | ||
}; | ||
// node.js or browserify; patch for node < v10 | ||
if(B_BROWSERIFY || (b_is_node && (+(/^v(\d+)/.exec(process.version)[1])) < 10)) { | ||
// override destroy methods | ||
Transform.prototype.destroy = Duplex.prototype.destroy = function(e_destroy, fke_destroy) { | ||
this._readableState.destroyed = true; | ||
this._writableState.destroyed = true; | ||
this._destroy(e_destroy || null, (e_destroy_re) => { | ||
if(!fke_destroy && e_destroy_re) { | ||
process.nextTick(() => { | ||
this.emit('error', e_destroy_re); | ||
f_emit_close(); | ||
}); | ||
this._writableState.errorEmitted = true; | ||
} | ||
else { | ||
process.nextTick(f_emit_close); | ||
if(fke_destroy) fke_destroy(e_destroy_re); | ||
} | ||
}); | ||
return this; | ||
let f_emit_close = () => { | ||
if(!this._writableState.emitClose) return; | ||
if(!this._readableState.emitClose) return; | ||
this.emit('close'); | ||
}; | ||
// override default _destroy implementations | ||
Transform.prototype._destroy = Duplex.prototype._destroy = (e_destroy, fke_destroy) => fke_destroy(e_destroy); | ||
} | ||
this._destroy(e_destroy || null, (e_destroy_re) => { | ||
if(!fke_destroy && e_destroy_re) { | ||
process.nextTick(() => { | ||
this.emit('error', e_destroy_re); | ||
f_emit_close(); | ||
}); | ||
this._writableState.errorEmitted = true; | ||
} | ||
else { | ||
process.nextTick(f_emit_close); | ||
if(fke_destroy) fke_destroy(e_destroy_re); | ||
} | ||
}); | ||
return this; | ||
}; | ||
// override default _destroy implementations | ||
Transform.prototype._destroy = Duplex.prototype._destroy = (e_destroy, fke_destroy) => fke_destroy(e_destroy); | ||
} | ||
@@ -433,0 +439,0 @@ |
{ | ||
"name": "@graphy/core.iso.stream", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Provides isomorphic stream interface for node.js / browser and adds `.until`, a promisified version of the `.on` event listener", | ||
@@ -29,2 +29,2 @@ "keywords": [ | ||
} | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12280
444
1