Bug Tracker

Modify

Ticket #10954 (closed enhancement: wontfix)

Opened 18 months ago

Last modified 18 months ago

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

comment:1 Changed 18 months ago by michaelmior

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

comment:2 Changed 18 months ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to core

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.