js: Convert _.indexOf(a, …) to a.indexOf(…).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-02-07 20:48:46 -08:00
committed by Tim Abbott
parent 29dbf8ec77
commit 788c5afbcf
4 changed files with 7 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ function add_pending_request(jqXHR) {
} }
function remove_pending_request(jqXHR) { function remove_pending_request(jqXHR) {
const pending_request_index = _.indexOf(pending_requests, jqXHR); const pending_request_index = pending_requests.indexOf(jqXHR);
if (pending_request_index !== -1) { if (pending_request_index !== -1) {
pending_requests.splice(pending_request_index, 1); pending_requests.splice(pending_request_index, 1);
} }

View File

@@ -142,7 +142,7 @@ exports.update_messages = function update_messages(events) {
// where the user initiated the edit. // where the user initiated the edit.
topic_edited = true; topic_edited = true;
const going_forward_change = _.indexOf(['change_later', 'change_all'], event.propagate_mode) >= 0; const going_forward_change = ['change_later', 'change_all'].indexOf(event.propagate_mode) >= 0;
const stream_name = stream_data.get_sub_by_id(event.stream_id).name; const stream_name = stream_data.get_sub_by_id(event.stream_id).name;
const compose_stream_name = compose_state.stream_name(); const compose_stream_name = compose_state.stream_name();
@@ -161,7 +161,7 @@ exports.update_messages = function update_messages(events) {
const current_filter = narrow_state.filter(); const current_filter = narrow_state.filter();
if (going_forward_change) { if (going_forward_change) {
const current_id = current_msg_list.selected_id(); const current_id = current_msg_list.selected_id();
const selection_changed_topic = _.indexOf(event.message_ids, current_id) >= 0; const selection_changed_topic = event.message_ids.indexOf(current_id) >= 0;
if (selection_changed_topic) { if (selection_changed_topic) {
if (current_filter && stream_name) { if (current_filter && stream_name) {
if (current_filter.has_topic(stream_name, orig_topic)) { if (current_filter.has_topic(stream_name, orig_topic)) {

View File

@@ -80,7 +80,7 @@ exports.wrap = function (lst, val) {
return exports.list_generator(lst); return exports.list_generator(lst);
} }
const i = _.indexOf(lst, val); const i = lst.indexOf(val);
if (i < 0) { if (i < 0) {
return exports.list_generator(lst); return exports.list_generator(lst);
} }
@@ -98,7 +98,7 @@ exports.wrap_exclude = function (lst, val) {
return exports.list_generator(lst); return exports.list_generator(lst);
} }
const i = _.indexOf(lst, val); const i = lst.indexOf(val);
if (i < 0) { if (i < 0) {
return exports.list_generator(lst); return exports.list_generator(lst);
} }
@@ -116,7 +116,7 @@ exports.reverse_wrap_exclude = function (lst, val) {
return exports.reverse_list_generator(lst); return exports.reverse_list_generator(lst);
} }
const i = _.indexOf(lst, val); const i = lst.indexOf(val);
if (i < 0) { if (i < 0) {
return exports.reverse_list_generator(lst); return exports.reverse_list_generator(lst);
} }

View File

@@ -12,7 +12,7 @@ function is_image_format(file) {
if (!type) { if (!type) {
return false; return false;
} }
return _.indexOf(supported_types, type) >= 0; return supported_types.indexOf(type) >= 0;
} }
exports.build_widget = function ( exports.build_widget = function (