perf(extend): remove use of forEach to remove calls/closures/passing arguments

Closes #8898
This commit is contained in:
Jason Bedard
2014-09-02 23:15:09 -07:00
committed by Igor Minar
parent df9e60c8e7
commit 9bedeb3353

View File

@@ -336,15 +336,19 @@ function setHashKey(obj, h) {
*/
function extend(dst) {
var h = dst.$$hashKey;
forEach(arguments, function(obj) {
if (obj !== dst) {
forEach(obj, function(value, key) {
dst[key] = value;
});
}
});
setHashKey(dst,h);
for (var i = 1, ii = arguments.length; i < ii; i++) {
var obj = arguments[i];
if (obj) {
var keys = Object.keys(obj);
for (var j = 0, jj = keys.length; j < jj; j++) {
var key = keys[j];
dst[key] = obj[key];
}
}
}
setHashKey(dst, h);
return dst;
}