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:
Anders Kaseorg
2020-02-07 19:08:04 -08:00
committed by Tim Abbott
parent 2285ee922e
commit 70ff164f89
15 changed files with 32 additions and 66 deletions

View File

@@ -75,7 +75,7 @@ function query_matches_string(query, source_str, split_char) {
// account, there might be 2 attrs: their full name and their email.
// * split_char is the separator for this syntax (e.g. ' ').
exports.query_matches_source_attrs = (query, source, match_attrs, split_char) => {
return _.any(match_attrs, function (attr) {
return match_attrs.some(attr => {
const source_str = source[attr].toLowerCase();
return query_matches_string(query, source_str, split_char);
});
@@ -151,9 +151,7 @@ exports.sort_emojis = function (objs, query) {
function decent_match(name) {
const pieces = name.toLowerCase().split('_');
return _.any(pieces, (piece) => {
return piece.startsWith(lowerQuery);
});
return pieces.some(piece => piece.startsWith(lowerQuery));
}
const popular_set = new Set(exports.popular_emojis);