-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspeculoos.js
57 lines (45 loc) · 1.22 KB
/
speculoos.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
45
46
47
48
49
50
51
52
53
54
55
56
/* by @k33g_org */
var root = this;
if (typeof exports === 'undefined') {
root.speculoos = root.speculoos || {};
}
(function(speculoos) {
var Class = (function() {
function Class(definition) {
/* from CoffeeScript */
var __hasProp = Object.prototype.hasOwnProperty
, m, F;
this["extends"] = function(child, parent) {
for (m in parent) {
if (__hasProp.call(parent, m)) child[m] = parent[m];
}
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = child["super"] = parent.prototype;
return child;
}
if(definition.constructor.name === "Object") {
F = function(){};
} else {
F = definition.constructor;
}
/* inheritance */
if(definition["extends"]) {
this["extends"](F, definition["extends"])
}
for(m in definition) {
if(m != 'constructor' && m != 'extends') {
if(m[0] != '$') {
F.prototype[m] = definition[m];
} else { /* static members */
F[m.split('$')[1]] = definition[m];
}
}
}
return F;
}
return Class;
})();
speculoos.Class = Class;
})(root.speculoos || exports);