diff options
author | Calvin Metcalf <cmetcalf@appgeo.com> | 2017-05-05 14:42:21 +0200 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2017-12-18 14:41:43 +0100 |
commit | 36ffa21af248c4f3d188d48e06c21e7ec8abe58d (patch) | |
tree | b9473613a2fb5e52fbbeb4decbfc8fa4052edbe1 /lib/_stream_writable.js | |
parent | 0a28f94df6e23f7669fd0fa9e52f7174175f78c4 (diff) | |
download | android-node-v8-36ffa21af248c4f3d188d48e06c21e7ec8abe58d.tar.gz android-node-v8-36ffa21af248c4f3d188d48e06c21e7ec8abe58d.tar.bz2 android-node-v8-36ffa21af248c4f3d188d48e06c21e7ec8abe58d.zip |
stream: rm {writeable/readable}State.length
As part of the readableState/writableState mega issue #445, this
removes all of the references to .length on those properties and
replaces them with a readableLength and writableLength getter.
See: https://github.com/nodejs/node/issues/445
PR-URL: https://github.com/nodejs/node/pull/12857
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/_stream_writable.js')
-rw-r--r-- | lib/_stream_writable.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 97fbebdd66..549bff1599 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -583,6 +583,15 @@ Writable.prototype.end = function(chunk, encoding, cb) { endWritable(this, state, cb); }; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get() { + return this._writableState.length; + } +}); function needFinish(state) { return (state.ending && @@ -657,6 +666,10 @@ function onCorkedFinish(corkReq, state, err) { } Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, get() { if (this._writableState === undefined) { return false; |