diff --git a/lodash.src.js b/lodash.src.js index 2140aa6b8..da2fdceb3 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -6040,6 +6040,9 @@ */ function every(collection, predicate, thisArg) { var func = isArray(collection) ? arrayEvery : baseEvery; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } if (typeof predicate != 'function' || typeof thisArg != 'undefined') { predicate = getCallback(predicate, thisArg, 3); } @@ -6476,9 +6479,9 @@ * * The guarded methods are: * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, - * `dropRight`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, `slice`, - * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, `trimRight`, - * `trunc`, `random`, `range`, `sample`, `uniq`, and `words` + * `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, + * `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, + * `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` * * @static * @memberOf _ @@ -6867,6 +6870,9 @@ */ function some(collection, predicate, thisArg) { var func = isArray(collection) ? arraySome : baseSome; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } if (typeof predicate != 'function' || typeof thisArg != 'undefined') { predicate = getCallback(predicate, thisArg, 3); } diff --git a/test/test.js b/test/test.js index e1e0c6509..b92c436bf 100644 --- a/test/test.js +++ b/test/test.js @@ -4276,6 +4276,11 @@ deepEqual(actual, expected); }); + test('should work as an iteratee for `_.map`', 1, function() { + var actual = _.map([[1]], _.every); + deepEqual(actual, [true]); + }); + test('should be aliased', 1, function() { strictEqual(_.all, _.every); }); @@ -12954,6 +12959,11 @@ deepEqual(actual, expected); }); + test('should work as an iteratee for `_.map`', 1, function() { + var actual = _.map([[1]], _.some); + deepEqual(actual, [true]); + }); + test('should be aliased', 1, function() { strictEqual(_.any, _.some); });