summaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-09-26 23:17:26 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-10-01 12:38:37 +0200
commit5e6940d4f6e59433976dc09979f3c8fb116b4230 (patch)
tree65597c2babccd7f9e829a15fa08228c668ea74a3 /lib/util.js
parent6df2c556bda34bd685f4086907ca00cdd7b2ea77 (diff)
downloadandroid-node-v8-5e6940d4f6e59433976dc09979f3c8fb116b4230.tar.gz
android-node-v8-5e6940d4f6e59433976dc09979f3c8fb116b4230.tar.bz2
android-node-v8-5e6940d4f6e59433976dc09979f3c8fb116b4230.zip
util: set `super_` property to non-enumerable
Using `util.inherits()` adds a `super_` property to the constructor and inspecting that constructor is going to show that property even though it's not useful for the user. Therefore the property is now set as non-enumerable and such entries are not visible by default when using `console.log()` or `util.inspect()`. PR-URL: https://github.com/nodejs/node/pull/23107 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/util.js b/lib/util.js
index ae2295533d..8eaf62f0ab 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -285,7 +285,11 @@ function inherits(ctor, superCtor) {
throw new ERR_INVALID_ARG_TYPE('superCtor.prototype',
'Function', superCtor.prototype);
}
- ctor.super_ = superCtor;
+ Object.defineProperty(ctor, 'super_', {
+ value: superCtor,
+ writable: true,
+ configurable: true
+ });
Object.setPrototypeOf(ctor.prototype, superCtor.prototype);
}