diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index 9613322e..f5a5613c 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -95,7 +95,7 @@ Ox.count = function(collection, value) { Ox.every Tests if every element of a collection satisfies a given condition Unlike `Array.prototype.every`, `Ox.every` works for arrays, objects and strings. - (collection, iterator) -> True if every element passes the test + (collection[, iterator]) -> True if every element passes the test collection Collection iterator Iterator value <*> Value @@ -173,20 +173,22 @@ Ox.forEach = function(collection, iterator, that) { var i = 0, key, type = Ox.typeOf(collection); if (type == 'object' || type == 'storage') { for (key in collection) { - if (Ox.hasOwn(collection, key)) { - if (iterator.call(that, collection[key], key, collection) === false) { - break; - } + if ( + Ox.hasOwn(collection, key) + && iterator.call(that, collection[key], key, collection) === false + ) { + break; } i++; } } else { collection = Ox.toArray(collection); for (i = 0; i < collection.length; i++) { - if (i in collection) { - if (iterator.call(that, collection[i], i, collection) === false) { - break; - } + if ( + i in collection + && iterator.call(that, collection[i], i, collection) === false + ) { + break; } } } @@ -303,6 +305,8 @@ Ox.max Returns the maximum value of a collection 3 > Ox.max('123') 3 + > Ox.max([]) + -Infinity @*/ Ox.max = function(collection) { var ret, values = Ox.values(collection); @@ -324,6 +328,8 @@ Ox.min Returns the minimum value of a collection 1 > Ox.min('123') 1 + > Ox.min([]) + Infinity @*/ Ox.min = function(collection) { var ret, values = Ox.values(collection); @@ -468,7 +474,7 @@ Ox.objectToArray = function(object, key) { Ox.forEach(object, function(v, k) { ret.push(Ox.extend(v, key, k)); }); - return ret + return ret; }; */