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.

stream_data: Simplify compare code.

Aman Agrawal445819e110b7
diff --git a/web/src/stream_data.js b/web/src/stream_data.js
index c1ab54a61ac..74cb4ed332a 100644
--- a/web/src/stream_data.js
+++ b/web/src/stream_data.js
@@ -851,23 +851,11 @@ export function remove_default_stream(stream_id) {
}
export function get_options_for_dropdown_widget() {
- return (
- subscribed_subs()
- .map((stream) => ({
- name: stream.name,
- unique_id: stream.stream_id,
- stream,
- }))
- // eslint-disable-next-line consistent-return, array-callback-return
- .sort((a, b) => {
- if (a.name.toLowerCase() < b.name.toLowerCase()) {
- return -1;
- }
- if (a.name.toLowerCase() > b.name.toLowerCase()) {
- return 1;
- }
- // Not possible since two streams cannot have same name.
- // return 0;
- })
- );
+ return subscribed_subs()
+ .map((stream) => ({
+ name: stream.name,
+ unique_id: stream.stream_id,
+ stream,
+ }))
+ .sort((a, b) => util.strcmp(a.name.toLowerCase(), b.name.toLowerCase()));
}