From 2f314a085428c7a09c871c987c305a43af8a296b Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 7 Feb 2020 17:24:21 -0800 Subject: [PATCH] js: Convert _.map on jQuery collections to Array.from. Signed-off-by: Anders Kaseorg --- static/js/compose.js | 2 +- static/js/stream_create.js | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/static/js/compose.js b/static/js/compose.js index ebdaa44576..900ab4da2e 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -887,7 +887,7 @@ exports.warn_if_mentioning_unsubscribed_user = function (mentioned) { const error_area = $("#compose_invite_users"); const existing_invites_area = $('#compose_invite_users .compose_invite_user'); - const existing_invites = _.map($(existing_invites_area), function (user_row) { + const existing_invites = Array.from($(existing_invites_area), user_row => { return $(user_row).data('useremail'); }); diff --git a/static/js/stream_create.js b/static/js/stream_create.js index c5fc6a6369..5ad48184ad 100644 --- a/static/js/stream_create.js +++ b/static/js/stream_create.js @@ -169,13 +169,10 @@ function update_announce_stream_state() { } function get_principals() { - return _.map( - $("#stream_creation_form input:checkbox[name=user]:checked"), - function (elem) { - const label = $(elem).closest('.add-user-label'); - return parseInt(label.attr('data-user-id'), 10); - } - ); + return Array.from($("#stream_creation_form input:checkbox[name=user]:checked"), elem => { + const label = $(elem).closest(".add-user-label"); + return parseInt(label.attr("data-user-id"), 10); + }); } function create_stream() {