diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index a71fd6ac..ce2c6cb4 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -111,9 +111,9 @@ Ox.every Tests if every element of a collection satisfies a given condition > Ox.every([true, true, true]) true @*/ -Ox.every = function(collection, iterator) { +Ox.every = function(collection, iterator, that) { return Ox.filter( - Ox.values(collection), iterator || Ox.identity + Ox.values(collection), iterator || Ox.identity, that ).length == Ox.len(collection); }; @@ -506,16 +506,11 @@ Ox.some Tests if one or more elements of a collection meet a given condition > Ox.some([false, null, 0, '', void 0]) false @*/ -Ox.some = function(collection, iterator) { - iterator = iterator || Ox.identity; - var ret = false; - Ox.forEach(collection, function(value, key, collection) { - if (iterator(value, key, collection)) { - ret = true; - return false; // break - } - }); - return ret; +Ox.some = function(collection, iterator, that) { + iterator = iterator || Ox.identity; + return Ox.forEach(collection, function(value, key, collection) { + return !iterator.call(that, value, key, collection); + }) < Ox.len(collection); }; /*@