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