throw warning, not error, when returning false from Ox.forEach or Ox.loop
This commit is contained in:
parent
95de001d8b
commit
91026a0c77
2 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue