Lines Matching refs:obj
22 Object.prototype.clone = function (obj) {
23 if (typeof(obj) != "object") return obj;
24 try { var newObject = new obj.constructor(); } catch(e) {return null;}
25 for (var objectItem in obj) {
26 if (!obj.hasOwnProperty(objectItem)) continue;
27 newObject[objectItem] = obj.clone(obj[objectItem]);
42 Object.prototype.merge = function (obj, overwrite) {
46 try { var n = new obj.constructor(); } catch(e) {return null;}
49 for (var i in obj) {
50 if (!obj.hasOwnProperty(i)) continue;
51 if (isUndefined(this[i]) || (overwrite && typeof this[i] != typeof obj))
52 if (obj[i] instanceof Array) this[i] = [];
53 else if ('object' == typeof obj[i]) this[i] = {};
54 if (obj[i] instanceof Array) this[i] = this[i].concat(obj[i]);
55 else if ('object' == typeof obj[i]) this[i].merge(obj[i], overwrite);
56 else if (isUndefined(this[i]) || overwrite) this[i] = obj[i];