padolsey/relevancy.js

Searching objects

theluk opened this issue · 1 comments

Hi there.

is there a way to search in objects and return them? or is this on your list already?

var items = [{ title:"London"}, {title:"Munich"}];
Sorter.sort(items, "Lon", "title");
//or
Sorter.sort(items, "Lon", function(obj) { return obj.title });

This is now possible with the following calling pattern:

var items = [{ title:"London"}, {title:"Munich"}];
Sorter.sort(items, "Lon", function(obj, calc) { return calc(obj.title) });