diff --git a/static/js/emoji_picker.js b/static/js/emoji_picker.js index 14d5b8c6e7..d4d7b62202 100644 --- a/static/js/emoji_picker.js +++ b/static/js/emoji_picker.js @@ -215,9 +215,7 @@ function filter_emojis() { for (const emoji_dict of emojis) { for (const alias of emoji_dict.aliases) { - const match = _.every(search_terms, function (search_term) { - return alias.includes(search_term); - }); + const match = search_terms.every(search_term => alias.includes(search_term)); if (match) { search_results.push(_.extend({}, emoji_dict, {name: alias})); break; // We only need the first matching alias per emoji. diff --git a/static/js/filter.js b/static/js/filter.js index b8270afdad..f37744b150 100644 --- a/static/js/filter.js +++ b/static/js/filter.js @@ -572,7 +572,7 @@ Filter.prototype = { // build JavaScript code in a string and then eval() it. return function (message) { - return _.all(operators, function (term) { + return operators.every(term => { let ok = message_matches_search_term(message, term.operator, term.operand); if (term.negated) { ok = !ok; diff --git a/static/js/people.js b/static/js/people.js index 28707a01c2..81de175e0b 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -162,7 +162,7 @@ exports.user_ids_string_to_emails_string = function (user_ids_string) { return person && person.email; }); - if (!_.all(emails)) { + if (!emails.every(Boolean)) { blueslip.warn('Unknown user ids: ' + user_ids_string); return; } @@ -201,7 +201,7 @@ exports.reply_to_to_user_ids_string = function (emails_string) { return person && person.user_id; }); - if (!_.all(user_ids)) { + if (!user_ids.every(Boolean)) { return; } @@ -257,7 +257,7 @@ exports.email_list_to_user_ids_string = function (emails) { return person && person.user_id; }); - if (!_.all(user_ids)) { + if (!user_ids.every(Boolean)) { blueslip.warn('Unknown emails: ' + emails); return; } @@ -464,7 +464,7 @@ exports.update_email_in_reply_to = function (reply_to, user_id, new_email) { const persons = emails.map(email => people_dict.get(email.trim())); - if (!_.all(persons)) { + if (!persons.every(Boolean)) { return reply_to; } @@ -494,7 +494,7 @@ exports.pm_with_operand_ids = function (operand) { persons = _.without(persons, people_by_user_id_dict.get(my_user_id)); } - if (!_.all(persons)) { + if (!persons.every(Boolean)) { return; } @@ -643,7 +643,7 @@ exports.is_valid_email_for_compose = function (email) { exports.is_valid_bulk_emails_for_compose = function (emails) { // Returns false if at least one of the emails is invalid. - return _.every(emails, function (email) { + return emails.every(email => { if (!exports.is_valid_email_for_compose(email)) { return false; } @@ -804,9 +804,7 @@ exports.build_person_matcher = function (query) { return true; } - return _.all(termlet_matchers, function (matcher) { - return matcher(user); - }); + return termlet_matchers.every(matcher => matcher(user)); }; }; diff --git a/static/js/stream_data.js b/static/js/stream_data.js index 450829a6a1..8bd72bf291 100644 --- a/static/js/stream_data.js +++ b/static/js/stream_data.js @@ -166,9 +166,7 @@ exports.is_subscriber_subset = function (sub1, sub2) { if (sub1.subscribers && sub2.subscribers) { const sub2_set = sub2.subscribers; - return _.every(Array.from(sub1.subscribers.keys()), (key) => { - return sub2_set.has(key); - }); + return Array.from(sub1.subscribers.keys()).every(key => sub2_set.has(key)); } return false; @@ -451,9 +449,7 @@ exports.update_calculated_fields = function (sub) { }; exports.all_subscribed_streams_are_in_home_view = function () { - return _.every(exports.subscribed_subs(), function (sub) { - return !sub.is_muted; - }); + return exports.subscribed_subs().every(sub => !sub.is_muted); }; exports.home_view_stream_names = function () { diff --git a/static/js/tictactoe_widget.js b/static/js/tictactoe_widget.js index c3b3acce28..66c8f692f1 100644 --- a/static/js/tictactoe_widget.js +++ b/static/js/tictactoe_widget.js @@ -38,7 +38,7 @@ const tictactoe_data_holder = function () { return square_values[i]; } - return lines.some(line_won) || _.all(board, filled); + return lines.some(line_won) || board.every(filled); } self.get_widget_data = function () { diff --git a/static/js/vdom.js b/static/js/vdom.js index 63a198969a..281bd2043c 100644 --- a/static/js/vdom.js +++ b/static/js/vdom.js @@ -13,9 +13,7 @@ exports.eq_array = (a, b, eq) => { return false; } - return _.all(a, (item, i) => { - return eq(item, b[i]); - }); + return a.every((item, i) => eq(item, b[i])); }; exports.ul = (opts) => {