Created
December 7, 2016 23:36
-
-
Save sammoore/cbe7e65233dcb8681bf6b06d809ec2ce to your computer and use it in GitHub Desktop.
inherits, as implemented in NodeJS circa ES5, but also defining superClass_ to maintain compatibility with existing in-browser inherits implementations.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function inherits(ctor, superCtor) { | |
ctor.superClass_ = ctor.super_ = superCtor; | |
ctor.prototype = Object.create(superCtor.prototype, { | |
constructor: { | |
value: ctor, | |
enumerable: false, | |
writable: true, | |
configurable: true, | |
}, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment