Skip to content

Commit

Permalink
define _.reject as the complement of _.filter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchambers committed Mar 5, 2014
1 parent 4511a8a commit 53c59df
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@

// Return all the elements for which a truth test fails.
_.reject = function(obj, predicate, context) {
return _.filter(obj, function(value, index, list) {
return !predicate.call(context, value, index, list);
}, context);
return _.filter(obj, _.complement(predicate), context);
};

// Determine whether all of the elements match a truth test.
Expand Down

0 comments on commit 53c59df

Please sign in to comment.