perf(forEach): use native for loop instead of forEach for Arrays

Conflicts:
	src/Angular.js
This commit is contained in:
Igor Minar
2014-06-30 08:48:25 -07:00
parent 51863f80d7
commit 492b0cdf28
+5 -4
View File
@@ -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)) {