diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index ce2c6cb4..efcb41ac 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -106,15 +106,16 @@ Ox.every Tests if every element of a collection satisfies a given condition true > Ox.every({a: 1, b: 2, c: 3}, function(v) { return v == 1; }) false - > Ox.every("foo", function(v) { return v == 'f'; }) + > Ox.every('foo', function(v) { return v == 'f'; }) false > Ox.every([true, true, true]) true @*/ Ox.every = function(collection, iterator, that) { - return Ox.filter( - Ox.values(collection), iterator || Ox.identity, that - ).length == Ox.len(collection); + iterator = iterator || Ox.identity; + return Ox.forEach(collection, function(value, key, collection) { + return !!iterator.call(that, value, key, collection); + }) == Ox.len(collection); }; /*@