-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Closed
Labels
good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
Description
Currently, util.inherits
does this:
Lines 300 to 318 in e1aa730
function inherits(ctor, superCtor) { | |
if (ctor === undefined || ctor === null) | |
throw new ERR_INVALID_ARG_TYPE('ctor', 'Function', ctor); | |
if (superCtor === undefined || superCtor === null) | |
throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor); | |
if (superCtor.prototype === undefined) { | |
throw new ERR_INVALID_ARG_TYPE('superCtor.prototype', | |
'Function', superCtor.prototype); | |
} | |
Object.defineProperty(ctor, 'super_', { | |
value: superCtor, | |
writable: true, | |
configurable: true | |
}); | |
Object.setPrototypeOf(ctor.prototype, superCtor.prototype); | |
} |
Most of the code seems unnecessary for our internal use. Essentially we can just replace all the internal util.inherits
usage with Object.setPrototypeOf(ctor.prototype, superCtor.prototype)
Unless someone is relying on that ctor._super
property existing on our internal types..
Any thoughts?
refack, marvinhagemeister, ZYSzys, starkwang, bnoordhuis and 4 more
Metadata
Metadata
Assignees
Labels
good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.