perf(forEach): use native for loop instead of forEach for Arrays
Conflicts: src/Angular.js
This commit is contained in:
+5
-4
@@ -240,11 +240,12 @@ function forEach(obj, iterator, context) {
|
||||
iterator.call(context, obj[key], key);
|
||||
}
|
||||
}
|
||||
} else if (obj.forEach && obj.forEach !== forEach) {
|
||||
obj.forEach(iterator, context);
|
||||
} else if (isArrayLike(obj)) {
|
||||
for (key = 0; key < obj.length; key++)
|
||||
} else if (isArray(obj) || isArrayLike(obj)) {
|
||||
for (key = 0; key < obj.length; key++) {
|
||||
iterator.call(context, obj[key], key);
|
||||
}
|
||||
} else if (obj.forEach && obj.forEach !== forEach) {
|
||||
obj.forEach(iterator, context);
|
||||
} else {
|
||||
for (key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
|
||||
Reference in New Issue
Block a user