summaryrefslogtreecommitdiff
path: root/lib/zlib.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-11-30 17:55:48 +0100
committerAnna Henningsen <anna@addaleax.net>2018-12-05 16:53:58 +0100
commitdcc82b37b631d636e0fefc8272c357ec4a7d6df2 (patch)
tree0a036ccfa7448c8d50628831084e9863a14a0766 /lib/zlib.js
parent6ccc80c82a7e21bc9315d6fdccea62ce8e2712a7 (diff)
downloadandroid-node-v8-dcc82b37b631d636e0fefc8272c357ec4a7d6df2.tar.gz
android-node-v8-dcc82b37b631d636e0fefc8272c357ec4a7d6df2.tar.bz2
android-node-v8-dcc82b37b631d636e0fefc8272c357ec4a7d6df2.zip
lib: remove `inherits()` usage
This switches all `util.inherits()` calls to use `Object.setPrototypeOf()` instead. In fact, `util.inherits()` is mainly a small wrapper around exactly this function while adding the `_super` property on the object as well. Refs: #24395 PR-URL: https://github.com/nodejs/node/pull/24755 Refs: https://github.com/nodejs/node/issues/24395 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/zlib.js')
-rw-r--r--lib/zlib.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/zlib.js b/lib/zlib.js
index 559f6c2d5f..ba7a3c5f05 100644
--- a/lib/zlib.js
+++ b/lib/zlib.js
@@ -31,7 +31,6 @@ const Transform = require('_stream_transform');
const {
deprecate,
_extend,
- inherits,
types: {
isAnyArrayBuffer,
isArrayBufferView
@@ -318,7 +317,7 @@ function Zlib(opts, mode) {
this._info = opts && opts.info;
this.once('end', this.close);
}
-inherits(Zlib, Transform);
+Object.setPrototypeOf(Zlib.prototype, Transform.prototype);
Object.defineProperty(Zlib.prototype, '_closed', {
configurable: true,
@@ -648,28 +647,28 @@ function Deflate(opts) {
return new Deflate(opts);
Zlib.call(this, opts, DEFLATE);
}
-inherits(Deflate, Zlib);
+Object.setPrototypeOf(Deflate.prototype, Zlib.prototype);
function Inflate(opts) {
if (!(this instanceof Inflate))
return new Inflate(opts);
Zlib.call(this, opts, INFLATE);
}
-inherits(Inflate, Zlib);
+Object.setPrototypeOf(Inflate.prototype, Zlib.prototype);
function Gzip(opts) {
if (!(this instanceof Gzip))
return new Gzip(opts);
Zlib.call(this, opts, GZIP);
}
-inherits(Gzip, Zlib);
+Object.setPrototypeOf(Gzip.prototype, Zlib.prototype);
function Gunzip(opts) {
if (!(this instanceof Gunzip))
return new Gunzip(opts);
Zlib.call(this, opts, GUNZIP);
}
-inherits(Gunzip, Zlib);
+Object.setPrototypeOf(Gunzip.prototype, Zlib.prototype);
function DeflateRaw(opts) {
if (opts && opts.windowBits === 8) opts.windowBits = 9;
@@ -677,21 +676,21 @@ function DeflateRaw(opts) {
return new DeflateRaw(opts);
Zlib.call(this, opts, DEFLATERAW);
}
-inherits(DeflateRaw, Zlib);
+Object.setPrototypeOf(DeflateRaw.prototype, Zlib.prototype);
function InflateRaw(opts) {
if (!(this instanceof InflateRaw))
return new InflateRaw(opts);
Zlib.call(this, opts, INFLATERAW);
}
-inherits(InflateRaw, Zlib);
+Object.setPrototypeOf(InflateRaw.prototype, Zlib.prototype);
function Unzip(opts) {
if (!(this instanceof Unzip))
return new Unzip(opts);
Zlib.call(this, opts, UNZIP);
}
-inherits(Unzip, Zlib);
+Object.setPrototypeOf(Unzip.prototype, Zlib.prototype);
function createConvenienceMethod(ctor, sync) {
if (sync) {