You could do this:
var index = Link(items).pluck('id').indexOf('battlers');
If you want to filter for any reason and keep a reference to the original index, there is a way by using the new second argument in link 0.3.0:
var index = 0;
Link(items).filterBy('id', 'battlers').each(function(item, idx) { if (item.id == 'battlers') index = idx; });
index; // use index from here on out.
Either I need to add a getRealIndex() method (versus the indexOf which gets the post-filtered index) or I research a way to efficiently return early from an each operation.
Then there is the question:
Should indexOf use the post-filtered index or should it grab the original index? I ask because the indexOf operation is fast since I don't have to copy values to a new intermediate array to get the post-filtered index.
It would suck to have to do something like:
Link(Link(array).filter().toArray()).indexOf();
It's better to:
Link(array).filter().indexOf();
Link(array).filter().oldIndexOf(); //or whatever I end up calling it
I've always liked the C-style one word naming convention, so I want to avoid an unnecessarily wordy API, even if it describes the action well enough.