bettor function iterator

This commit is contained in:
Misko Hevery 2010-04-16 20:10:09 -07:00
parent 6470b48ce0
commit 8394353b85
3 changed files with 5 additions and 3693 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ angular-minified.map
externs.js
angular.js
angular-minified.js
angular-debug.js

3689
angular-debug.js vendored

File diff suppressed because it is too large Load diff

View file

@ -36,14 +36,14 @@ function angularAlert(){
function foreach(obj, iterator, context) {
var key;
if (obj) {
if (obj.forEach) {
obj.forEach(iterator, context);
} else if (isFunction(obj)){
if (isFunction(obj)){
for (key in obj) {
if (key != 'prototype' && key != 'length' && key != 'name') {
if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key);
}
}
} else if (obj.forEach) {
obj.forEach(iterator, context);
} else if (isObject(obj) && isNumber(obj.length)) {
for (key = 0; key < obj.length; key++)
iterator.call(context, obj[key], key);