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

Commit 36625de

Browse files
committed
perf(forEach): use native for loop instead of forEach for Arrays
1 parent 31ae3e7 commit 36625de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Angular.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ function forEach(obj, iterator, context) {
245245
iterator.call(context, obj[key], key);
246246
}
247247
}
248-
} else if (obj.forEach && obj.forEach !== forEach) {
249-
obj.forEach(iterator, context);
250-
} else if (isArrayLike(obj)) {
248+
} else if (isArray(obj) || isArrayLike(obj)) {
251249
for (key = 0, length = obj.length; key < length; key++) {
252250
iterator.call(context, obj[key], key);
253251
}
252+
} else if (obj.forEach && obj.forEach !== forEach) {
253+
obj.forEach(iterator, context);
254254
} else {
255255
for (key in obj) {
256256
if (obj.hasOwnProperty(key)) {

0 commit comments

Comments
 (0)