28 lines
721 B
28 lines
721 B
2 years ago
|
var inherits;
|
||
|
if (typeof Object.create === 'function'){
|
||
|
inherits = function inherits(ctor, superCtor) {
|
||
|
// implementation from standard node.js 'util' module
|
||
|
ctor.super_ = superCtor
|
||
|
ctor.prototype = Object.create(superCtor.prototype, {
|
||
|
constructor: {
|
||
|
value: ctor,
|
||
|
enumerable: false,
|
||
|
writable: true,
|
||
|
configurable: true
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
} else {
|
||
|
inherits = function inherits(ctor, superCtor) {
|
||
|
ctor.super_ = superCtor
|
||
|
var TempCtor = function () {}
|
||
|
TempCtor.prototype = superCtor.prototype
|
||
|
ctor.prototype = new TempCtor()
|
||
|
ctor.prototype.constructor = ctor
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default inherits;
|
||
|
// module.exports = inherits;
|
||
|
// export default inherits;
|