From 9073fa20cb45851e86eaf58c4f490bb9e0d6f69c Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sat, 6 Jan 2024 15:00:36 +0100 Subject: [PATCH] Sanity-check decaffeinate app.views.ListSelect --- assets/javascripts/views/list/list_select.js | 26 +++----------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/assets/javascripts/views/list/list_select.js b/assets/javascripts/views/list/list_select.js index 7d48b1b4..3eee4209 100644 --- a/assets/javascripts/views/list/list_select.js +++ b/assets/javascripts/views/list/list_select.js @@ -1,18 +1,7 @@ -// TODO: This file was created by bulk-decaffeinate. -// Sanity-check the conversion and remove this comment. -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining - * DS206: Consider reworking classes to avoid initClass - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md - */ app.views.ListSelect = class ListSelect extends app.View { - static initClass() { - this.activeClass = "active"; + static activeClass = "active"; - this.events = { click: "onClick" }; - } + static events = { click: "onClick" }; deactivate() { if (super.deactivate(...arguments)) { @@ -37,9 +26,7 @@ app.views.ListSelect = class ListSelect extends app.View { } selectByHref(href) { - if ( - __guard__(this.getSelection(), (x) => x.getAttribute("href")) !== href - ) { + if (this.getSelection()?.getAttribute("href") !== href) { this.select(this.find(`a[href='${href}']`)); } } @@ -62,10 +49,3 @@ app.views.ListSelect = class ListSelect extends app.View { } } }; -app.views.ListSelect.initClass(); - -function __guard__(value, transform) { - return typeof value !== "undefined" && value !== null - ? transform(value) - : undefined; -}