mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
perf(extend): remove use of forEach to remove calls/closures/passing arguments
Closes #8898
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user