throw warning, not error, when returning false from Ox.forEach or Ox.loop

This commit is contained in:
rolux 2012-05-30 19:25:18 +02:00
parent 95de001d8b
commit 91026a0c77
2 changed files with 6 additions and 3 deletions

View file

@ -158,7 +158,8 @@ Ox.forEach = function(collection, iterator, that) {
if (Ox.hasOwn(collection, key)) {
// iterator.call(that, collection[key], key, collection);
if (iterator.call(that, collection[key], key, collection) === false) {
throw new Error('Returning false in Ox.forEach is deprecated.');
console.warn('Returning false in Ox.forEach is deprecated.');
break;
}
}
}
@ -167,7 +168,8 @@ Ox.forEach = function(collection, iterator, that) {
if (i in collection) {
// iterator.call(that, collection[i], i, collection);
if (iterator.call(that, collection[i], i, collection) === false) {
throw new Error('Returning false in Ox.forEach is deprecated.');
console.warn('Returning false in Ox.forEach is deprecated.');
break;
}
}
}

View file

@ -275,7 +275,8 @@ Ox.loop = function() {
for (i = start; step > 0 ? i < stop : i > stop; i += step) {
// iterator(i);
if (iterator(i) === false) {
throw new Error('Returning false in Ox.loop is deprecated.');
console.warn('Returning false in Ox.loop is deprecated.');
break;
}
}
} catch (error) {