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.

js: Use method chaining for multiple array operations.

Priyank Patel288fe6d388f7
diff --git a/static/js/util.js b/static/js/util.js
index f74a1fe9155..be71ff0da77 100644
--- a/static/js/util.js
+++ b/static/js/util.js
@@ -93,11 +93,12 @@ export function normalize_recipients(recipients) {
// Converts a string listing emails of message recipients
// into a canonical formatting: emails sorted ASCIIbetically
// with exactly one comma and no spaces between each.
- recipients = recipients.split(",").map((s) => s.trim());
- recipients = recipients.map((s) => s.toLowerCase());
- recipients = recipients.filter((s) => s.length > 0);
- recipients.sort();
- return recipients.join(",");
+ return recipients
+ .split(",")
+ .map((s) => s.trim().toLowerCase())
+ .filter((s) => s.length > 0)
+ .sort()
+ .join(",");
}
// Avoid URI decode errors by removing characters from the end