mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
js: Convert _.any(a, …), _.some(a, …) to a.some(…).
And convert the corresponding function expressions to arrow style while we’re here. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
2285ee922e
commit
70ff164f89
@@ -17,13 +17,11 @@ function filter_streams_by_search(streams, search_term) {
|
||||
let search_terms = search_term.toLowerCase().split(",");
|
||||
search_terms = search_terms.map(s => s.trim());
|
||||
|
||||
const filtered_streams = streams.filter(stream => _.any(search_terms, function (search_term) {
|
||||
const filtered_streams = streams.filter(stream => search_terms.some(search_term => {
|
||||
const lower_stream_name = stream.toLowerCase();
|
||||
const cands = lower_stream_name.split(" ");
|
||||
cands.push(lower_stream_name);
|
||||
return _.any(cands, function (name) {
|
||||
return name.startsWith(search_term);
|
||||
});
|
||||
return cands.some(name => name.startsWith(search_term));
|
||||
}));
|
||||
|
||||
return filtered_streams;
|
||||
|
||||
Reference in New Issue
Block a user