diff --git a/frontend_tests/zjsunit/bugdown_assert.js b/frontend_tests/zjsunit/bugdown_assert.js index c303049d55..46bfd8989a 100644 --- a/frontend_tests/zjsunit/bugdown_assert.js +++ b/frontend_tests/zjsunit/bugdown_assert.js @@ -58,10 +58,8 @@ class MarkdownComparer { if (node1.content.childNodes.length !== node2.content.childNodes.length) { return false; } - return _.reduce( - _.zip(node1.content.childNodes, node2.content.childNodes), - (prev, nodePair) => { return prev && nodePair[0].isEqualNode(nodePair[1]); }, - true + return _.zip(node1.content.childNodes, node2.content.childNodes).every(([child1, child2]) => + child1.isEqualNode(child2) ); } diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index 55d7210c9a..805b9ceb36 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -366,12 +366,7 @@ function should_show_custom_query(query, items) { if (!query) { return false; } - const matched = _.reduce(items, function (matched, elem) { - if (elem.toLowerCase() === query.toLowerCase()) { - return true; - } - return matched; - }, false); + const matched = items.some(elem => elem.toLowerCase() === query.toLowerCase()); return !matched; } diff --git a/static/js/list_render.js b/static/js/list_render.js index 0b6c9649b6..8ca0c9002c 100644 --- a/static/js/list_render.js +++ b/static/js/list_render.js @@ -93,7 +93,8 @@ exports.create = function ($container, list, opts) { const slice = meta.filtered_list.slice(meta.offset, meta.offset + load_count); const finish = blueslip.start_timing('list_render ' + opts.name); - const html = _.reduce(slice, function (acc, item) { + let html = ""; + for (const item of slice) { let _item = opts.modifier(item); // if valid jQuery selection, attempt to grab all elements within @@ -116,9 +117,9 @@ exports.create = function ($container, list, opts) { _item = _item.outerHTML; } - // return the modified HTML or nothing if corrupt (null, undef, etc.). - return acc + (_item || ""); - }, ""); + // append the HTML or nothing if corrupt (null, undef, etc.). + html += _item || ""; + } finish();