documentcloud/underscore — Issue #413: Question about _.indexOf and _.find
Author: tobias104
Created: 2011-12-22 07:49:48+00:00
State: open

Is there any way to combine the functionality of these two methods?

I'd really like to be able to pass a function to _.indexOf and find the index of the first element that passes the test, but that would make it unnecessarily complicated to search for functions.

Is there a better way to do this than calling one after the other?
``var elem = _.find(list, func);
var index = _.indexOf(list, elem);``