Make prefix_sort just use obj itself if get_item is not passed in

(This facilitates using prefix_sort for a list that doesn't require
a function call to get to the object of interest.)

(imported from commit 5a0e550c313b9c57f0434c7246fcea451219d1b8)
This commit is contained in:
Steve Howell 2013-07-16 17:46:12 -04:00
parent ed622c457b
commit 6a8a403cc9

View File

@ -115,7 +115,13 @@ function prefix_sort(query, objs, get_item) {
var obj = objs.shift();
while (obj) {
var item = get_item(obj);
var item;
if (get_item) {
item = get_item(obj);
}
else {
item = obj;
}
if (item.indexOf(query) === 0)
beginswithCaseSensitive.push(obj);
else if (item.toLowerCase().indexOf(query.toLowerCase()) === 0)