Skip to content

Commit

Permalink
use findKey in _.some
Browse files Browse the repository at this point in the history
  • Loading branch information
clottes committed Feb 8, 2013
1 parent 608ab71 commit 9183a77
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,14 +658,16 @@ var till = _.till = _.until = function(obj, iterator, context, pass) {
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var any = _.some = _.any = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = false;
if (obj == null) return result;
if (obj.some === nativeSome) return obj.some(iterator, context);
each(obj, function(value, index, list) {
if (obj == null) return false;
if (obj.some === nativeSome) return obj.some(iterator || _.identity, context);
return findKey(obj, iterator, context) !== undefined;
/*
each(obj, function(value, index, list) {
if (result || (result = iterator.call(context, value, index, list))) return breaker;
});
return !!result;
*/
};

// Determine if the array or object contains a given value (using `===`).
Expand Down

0 comments on commit 9183a77

Please sign in to comment.