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

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:31:13 -08:00
committed by Tim Abbott
parent cdd774b790
commit 336a279005
9 changed files with 16 additions and 30 deletions

View File

@@ -98,9 +98,7 @@ exports.toggle = function (opts) {
maybe_go_right: maybe_go_right,
disable_tab: function (name) {
const value = _.find(opts.values, function (o) {
return o.key === name;
});
const value = opts.values.find(o => o.key === name);
const idx = opts.values.indexOf(value);
meta.$ind_tab.eq(idx).addClass('disabled');
@@ -118,9 +116,7 @@ exports.toggle = function (opts) {
// go through the process of finding the correct tab for a given name,
// and when found, select that one and provide the proper callback.
goto: function (name) {
const value = _.find(opts.values, function (o) {
return o.label === name || o.key === name;
});
const value = opts.values.find(o => o.label === name || o.key === name);
const idx = opts.values.indexOf(value);