copy¶
webix.
copy
(source)¶webix.copy helper.
Please look into the linked official documentation.
References¶
- helpers
assert()
,assert_level_in()
,assert_level_out()
,isArray()
,isDate()
.
Referenced by¶
- helpers
proxy()
,local
,toPDF()
,fullScreen()
.- components
DataProcessor()
.- mixins
DataStore()
,Touch()
,TreeDataMove()
,TreeStore()
,Undo()
,Values()
.- views
calendar()
,carousel()
,grouplist()
,slider()
,suggest()
.
External references¶
Code¶
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 | webix.copy = function(source){
webix.assert(source,"Invalid mixing target");
webix.assert_level_in();
var target;
if(arguments.length>1){
target = arguments[0];
source = arguments[1];
} else
target = (webix.isArray(source)?[]:{});
for (var method in source){
var from = source[method];
if(from && typeof from == "object" && !(from instanceof RegExp)){
if (!webix.isDate(from)){
target[method] = (webix.isArray(from)?[]:{});
webix.copy(target[method],from);
} else
target[method] = new Date(from);
} else {
target[method] = from;
}
}
webix.assert_level_out();
return target;
};
|