-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathclass.js
45 lines (34 loc) · 830 Bytes
/
class.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
"use strict";
/*
* Create rule center
* @def - default rule
* */
var _constructor_ = function () {
this.initialize.apply(this, arguments);
};
_constructor_.prototype.initialize = function (options) {
};
_constructor_.extend = function (obj) {
var _class = this.clone();
for (var i in obj) {
_class.prototype[i] = obj[i];
}
return _class;
};
_constructor_.clone = function () {
var temp,
_this = this;
temp = eval("(function(){ return " + _this.toString() + "}());");
function extend (dest, src) {
if (src.prototype && Object.keys(src.prototype).length > 0) {
dest.prototype = extend(dest.prototype || {}, src.prototype);
}
for (var i in src) {
dest[i] = src[i];
}
return dest;
}
temp = extend(temp, _this);
return temp;
};
module.exports = _constructor_;