Currently, underscore implements two different quantifiers;
This for aims to add two more quantifiers;
Added an _.exactly quantifier
- Similar to _.any and _.all, _.exactly returns true if an exact number of elements pass a truth test.
Covered condition when obj was null
- If obj is null, and count is 0, yield true.
Added testing functions for _.exactly
Merge remote-tracking branch 'upstream/master' into quantifier-exactly
Added an _.only quantifier
- Used for determining of only 1 element passes a truth test.
Added tests for _.only
The goal of Underscore isn't to provide every logical predicate under the sun, but rather the useful ones.
Got any real-world code handy with use cases for when you've needed these?
Looks like that's a "no".
(But, @joshdk — since you wrote them and you'd use them, they'd probably make a great underscore.predicates.js)