Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2fd0c17

Browse files
committed
perf(extend): remove use of forEach to remove calls/closures/passing arguments
1 parent d9cdb10 commit 2fd0c17

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Angular.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,16 @@ function setHashKey(obj, h) {
337337
*/
338338
function extend(dst) {
339339
var h = dst.$$hashKey;
340-
forEach(arguments, function(obj) {
340+
for (var i = 1, ii = arguments.length; i < ii; i++) {
341+
var obj = arguments[i];
341342
if (obj !== dst) {
342-
forEach(obj, function(value, key) {
343-
dst[key] = value;
344-
});
343+
for (var key in obj) {
344+
if (obj.hasOwnProperty(key)) {
345+
dst[key] = obj[key];
346+
}
347+
}
345348
}
346-
});
349+
}
347350

348351
setHashKey(dst,h);
349352
return dst;

0 commit comments

Comments
 (0)