mirror of
https://github.com/zulip/zulip.git
synced 2026-07-12 21:04:41 +08:00
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:
parent
ed622c457b
commit
6a8a403cc9
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user