aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-04-20 18:26:37 -0700
committerRebecca Turner <me@re-becca.org>2018-05-24 23:24:45 -0700
commit468ab4519e1b92473acefb22801497a1af6aebae (patch)
treebdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
parentac8226115e2192a7a46ba07789fa5136f74223e1 (diff)
downloadandroid-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/readable-stream/lib/_stream_duplex.js')
-rw-r--r--deps/npm/node_modules/readable-stream/lib/_stream_duplex.js35
1 files changed, 21 insertions, 14 deletions
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js b/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
index c599463dd8..a1ca813e5a 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
@@ -28,7 +28,7 @@
/*<replacement>*/
-var processNextTick = require('process-nextick-args');
+var pna = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
@@ -52,10 +52,13 @@ var Writable = require('./_stream_writable');
util.inherits(Duplex, Readable);
-var keys = objectKeys(Writable.prototype);
-for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
+{
+ // avoid scope creep, the keys array can then be collected
+ var keys = objectKeys(Writable.prototype);
+ for (var v = 0; v < keys.length; v++) {
+ var method = keys[v];
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
+ }
}
function Duplex(options) {
@@ -74,6 +77,16 @@ function Duplex(options) {
this.once('end', onend);
}
+Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
+ // making it explicit this property is not enumerable
+ // because otherwise some prototype manipulation in
+ // userland will fail
+ enumerable: false,
+ get: function () {
+ return this._writableState.highWaterMark;
+ }
+});
+
// the no-half-open enforcer
function onend() {
// if we allow half-open state, or if the writable side ended,
@@ -82,7 +95,7 @@ function onend() {
// no more data can be written.
// But allow more writes to happen in this tick.
- processNextTick(onEndNT, this);
+ pna.nextTick(onEndNT, this);
}
function onEndNT(self) {
@@ -114,11 +127,5 @@ Duplex.prototype._destroy = function (err, cb) {
this.push(null);
this.end();
- processNextTick(cb, err);
-};
-
-function forEach(xs, f) {
- for (var i = 0, l = xs.length; i < l; i++) {
- f(xs[i], i);
- }
-} \ No newline at end of file
+ pna.nextTick(cb, err);
+}; \ No newline at end of file