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

And convert the corresponding function expressions to arrow style
while we’re here.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-07 20:32:25 -08:00 committed by Tim Abbott
parent 336a279005
commit b566d11d69
2 changed files with 4 additions and 6 deletions

View File

@ -79,9 +79,7 @@ global.read_fixture_data = (fn) => {
function short_tb(tb) {
const lines = tb.split('\n');
const i = _.findIndex(lines, (line) => {
return line.includes('run_test') || line.includes('run_one_module');
});
const i = lines.findIndex(line => line.includes('run_test') || line.includes('run_one_module'));
if (i === -1) {
return tb;

View File

@ -104,9 +104,9 @@ exports.toggle_pin_to_top_stream = function (sub) {
};
exports.maybe_update_realm_default_stream_name = function (stream_id, new_name) {
const idx = _.findIndex(page_params.realm_default_streams, function (stream) {
return stream.stream_id === stream_id;
});
const idx = page_params.realm_default_streams.findIndex(
stream => stream.stream_id === stream_id
);
if (idx === -1) {
return;
}