Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

eslint: Fix unicorn/no-reduce.

Anders Kaseorge68595a3fc1f
diff --git a/static/js/stats/stats.js b/static/js/stats/stats.js
index 6371f324c02..d250b1b8ff2 100644
--- a/static/js/stats/stats.js
+++ b/static/js/stats/stats.js
@@ -405,7 +405,10 @@ function compute_summary_chart_data(time_series_data, num_steps, labels_) {
values[labels.length - 1] += sum;
}
}
- const total = values.reduce((a, b) => a + b, 0);
+ let total = 0;
+ for (const value of values) {
+ total += value;
+ }
return {
values,
labels,
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index 36f936ecf43..e4f491ef31f 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -594,12 +594,11 @@ exports.register_topic_handlers = function () {
$("#topic_stream_edit_form_error").show();
}
- const params = $("#move_topic_form")
- .serializeArray()
- .reduce((obj, item) => {
- obj[item.name] = item.value;
- return obj;
- }, {});
+ const params = Object.fromEntries(
+ $("#move_topic_form")
+ .serializeArray()
+ .map(({name, value}) => [name, value]),
+ );
const {old_topic_name, select_stream_id} = params;
let {