adding upload symbol
This commit is contained in:
parent
a8b9e1fd2c
commit
297ac0a141
2 changed files with 17 additions and 9 deletions
22
source/Ox.js
22
source/Ox.js
|
|
@ -289,21 +289,25 @@ Ox.avg = function(obj) {
|
|||
};
|
||||
|
||||
/*@
|
||||
Ox.clone <f> Returns a (deep) copy of an object or array
|
||||
Ox.clone <f> Returns a (shallow or deep) copy of an object or array
|
||||
> (function() { a = ['val']; b = Ox.clone(a); a[0] = null; return b[0]; }())
|
||||
'val'
|
||||
> (function() { a = {key: 'val'}; b = Ox.clone(a); a.key = null; return b.key; }())
|
||||
'val'
|
||||
@*/
|
||||
|
||||
Ox.clone = function(col) {
|
||||
// return Ox.isArray(col) ? col.slice() : Ox.extend({}, col);
|
||||
var clone = Ox.isArray(col) ? [] : {};
|
||||
Ox.forEach(col, function(val, key) {
|
||||
clone[key] = ['array', 'object'].indexOf(Ox.typeOf(val)) > -1
|
||||
? Ox.clone(val) : val;
|
||||
});
|
||||
return clone;
|
||||
Ox.clone = function(col, deep) {
|
||||
var ret;
|
||||
if (deep) {
|
||||
ret = Ox.isArray(col) ? [] : {};
|
||||
Ox.forEach(col, function(val, key) {
|
||||
ret[key] = ['array', 'object'].indexOf(Ox.typeOf(val)) > -1
|
||||
? Ox.clone(val) : val;
|
||||
});
|
||||
} else {
|
||||
ret = Ox.isArray(col) ? col.slice() : Ox.extend({}, col);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
/*@
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue