Side navigation
#10954 closed enhancement (wontfix)
Opened December 05, 2011 09:13PM UTC
Closed December 06, 2011 12:02AM UTC
The function parameter to jQuery.grep should be optional
Reported by: | michaelmior | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | core | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
It would be great if the team could consider making the function parameter to grep optional.
I would suggest that
$.grep(['a', 'b', false]);
be the equivalent of
$.grep(['a', 'b', false], function(x) { return x; });
to allow the removal of falsy values. Note that this wouldn't be a breaking change.
Here is a simple jsFiddle demonstrating the suggested behaviour:
http://jsfiddle.net/NwRBe/