UNPKG

721 BJavaScriptView Raw
1var inherits;
2if (typeof Object.create === 'function'){
3 inherits = function inherits(ctor, superCtor) {
4 // implementation from standard node.js 'util' module
5 ctor.super_ = superCtor
6 ctor.prototype = Object.create(superCtor.prototype, {
7 constructor: {
8 value: ctor,
9 enumerable: false,
10 writable: true,
11 configurable: true
12 }
13 });
14 };
15} else {
16 inherits = function inherits(ctor, superCtor) {
17 ctor.super_ = superCtor
18 var TempCtor = function () {}
19 TempCtor.prototype = superCtor.prototype
20 ctor.prototype = new TempCtor()
21 ctor.prototype.constructor = ctor
22 }
23}
24
25export default inherits;
26// module.exports = inherits;
27// export default inherits;