Modify ↓
Ticket #10954 (closed enhancement: wontfix)
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: | ||
| Blocking: | Blocked by: |
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.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Here is a simple jsFiddle demonstrating the suggested behaviour: http://jsfiddle.net/NwRBe/