-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (43 loc) · 1.37 KB
/
index.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(function ( root, factory ) {
if( typeof define !== 'undefined' && define.amd ) {
define([],factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.inherits = factory();
}
})(this, function (){
var hasOwn = {}.hasOwnProperty;
return (typeof Object.create == 'function' ) ? function ( child, parent ) {
//Backbone/CoffeeScript API
for (var key in parent) {
if (hasOwn.call(parent, key)) child[key] = parent[key];
}
child.__super__ = parent.prototype;
//node API
child.super_ = parent;
child.prototype = Object.create(parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
})
}
: function (child, parent) {
for (var key in parent) {
if (hasOwn.call(parent, key)) child[key] = parent[key];
}
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
//CoffeeScript API
child.__super__ = parent.prototype;
//node API
child.super_ = parent;
return child;
};
});