summaryrefslogtreecommitdiff
path: root/lib/_stream_readable.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_stream_readable.js')
-rw-r--r--lib/_stream_readable.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 71fd74b07b..69f46f80a0 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -21,7 +21,10 @@
'use strict';
-const { Object } = primordials;
+const {
+ ObjectDefineProperty,
+ ObjectSetPrototypeOf,
+} = primordials;
module.exports = Readable;
Readable.ReadableState = ReadableState;
@@ -49,8 +52,8 @@ let StringDecoder;
let createReadableStreamAsyncIterator;
let from;
-Object.setPrototypeOf(Readable.prototype, Stream.prototype);
-Object.setPrototypeOf(Readable, Stream);
+ObjectSetPrototypeOf(Readable.prototype, Stream.prototype);
+ObjectSetPrototypeOf(Readable, Stream);
const { errorOrDestroy } = destroyImpl;
const kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
@@ -157,7 +160,7 @@ function ReadableState(options, stream, isDuplex) {
}
// Legacy getter for `pipesCount`
-Object.defineProperty(ReadableState.prototype, 'pipesCount', {
+ObjectDefineProperty(ReadableState.prototype, 'pipesCount', {
get() {
return this.pipes.length;
}
@@ -187,7 +190,7 @@ function Readable(options) {
Stream.call(this);
}
-Object.defineProperty(Readable.prototype, 'destroyed', {
+ObjectDefineProperty(Readable.prototype, 'destroyed', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
@@ -211,7 +214,7 @@ Object.defineProperty(Readable.prototype, 'destroyed', {
}
});
-Object.defineProperty(Readable.prototype, 'readableEnded', {
+ObjectDefineProperty(Readable.prototype, 'readableEnded', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
@@ -1089,7 +1092,7 @@ Readable.prototype[Symbol.asyncIterator] = function() {
return createReadableStreamAsyncIterator(this);
};
-Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
+ObjectDefineProperty(Readable.prototype, 'readableHighWaterMark', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
@@ -1099,7 +1102,7 @@ Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
}
});
-Object.defineProperty(Readable.prototype, 'readableBuffer', {
+ObjectDefineProperty(Readable.prototype, 'readableBuffer', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
@@ -1109,7 +1112,7 @@ Object.defineProperty(Readable.prototype, 'readableBuffer', {
}
});
-Object.defineProperty(Readable.prototype, 'readableFlowing', {
+ObjectDefineProperty(Readable.prototype, 'readableFlowing', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
@@ -1127,7 +1130,7 @@ Object.defineProperty(Readable.prototype, 'readableFlowing', {
// Exposed for testing purposes only.
Readable._fromList = fromList;
-Object.defineProperty(Readable.prototype, 'readableLength', {
+ObjectDefineProperty(Readable.prototype, 'readableLength', {
// Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
@@ -1137,14 +1140,14 @@ Object.defineProperty(Readable.prototype, 'readableLength', {
}
});
-Object.defineProperty(Readable.prototype, 'readableObjectMode', {
+ObjectDefineProperty(Readable.prototype, 'readableObjectMode', {
enumerable: false,
get() {
return this._readableState ? this._readableState.objectMode : false;
}
});
-Object.defineProperty(Readable.prototype, 'readableEncoding', {
+ObjectDefineProperty(Readable.prototype, 'readableEncoding', {
enumerable: false,
get() {
return this._readableState ? this._readableState.encoding : null;