Bug Tracker

Opened 7 years ago

Closed 7 years ago

#10954 closed enhancement (wontfix)

The function parameter to jQuery.grep should be optional

Reported by: Michael Mior 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.

Change History (2)

comment:1 Changed 7 years ago by Michael Mior

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

comment:2 Changed 7 years ago by timmywil

Component: unfiledcore
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

Since grep is mainly used internally, I don't think this will make it into core.

Note: See TracTickets for help on using tickets.