From dcc82b37b631d636e0fefc8272c357ec4a7d6df2 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 30 Nov 2018 17:55:48 +0100 Subject: 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 Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina --- lib/perf_hooks.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/perf_hooks.js') diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 1086c4b519..b84498055f 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -33,7 +33,6 @@ const { const { AsyncResource } = require('async_hooks'); const L = require('internal/linkedlist'); const kInspect = require('internal/util').customInspectSymbol; -const { inherits } = require('util'); const kCallback = Symbol('callback'); const kTypes = Symbol('types'); @@ -208,10 +207,8 @@ class PerformanceNodeTiming { }; } } -// Use this instead of Extends because we want PerformanceEntry in the -// prototype chain but we do not want to use the PerformanceEntry -// constructor for this. -inherits(PerformanceNodeTiming, PerformanceEntry); +Object.setPrototypeOf( + PerformanceNodeTiming.prototype, PerformanceEntry.prototype); const nodeTiming = new PerformanceNodeTiming(); -- cgit v1.2.3