History

Sanity-check decaffeinate app.Shortcuts

Simon Legner committed 2 years ago

Commit c595b2b1 parent 3276b261 file · +2 −17Browse files

Unified · Split

assets/javascripts/app/shortcuts.js+2−17
@@ -1,12 +1,3 @@
1−// TODO: This file was created by bulk-decaffeinate.
2−// Sanity-check the conversion and remove this comment.
3−/*
4− * decaffeinate suggestions:
5− * DS102: Remove unnecessary code created because of implicit returns
6− * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining
7− * DS205: Consider reworking code to avoid use of IIFEs
8− * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
9− */
101 app.Shortcuts = class Shortcuts extends Events {
112 constructor() {
123 super();
@@ -215,13 +206,13 @@ app.Shortcuts = class Shortcuts extends Events { · 202 unmodified lines
215206 this.trigger("pageUp");
216207 return false;
217208 case 38:
218− if (!__guard__(getSelection(), (x) => x.toString())) {
209+ if (!getSelection()?.toString()) {
219210 this.trigger("altUp");
220211 return false;
221212 }
222213 break;
223214 case 40:
224− if (!__guard__(getSelection(), (x1) => x1.toString())) {
215+ if (!getSelection()?.toString()) {
225216 this.trigger("altDown");
226217 return false;
227218 }
@@ -302,9 +293,3 @@ app.Shortcuts = class Shortcuts extends Events { · 74 unmodified lines
302293 }
303294 }
304295 };
305−
306−function __guard__(value, transform) {
307− return typeof value !== "undefined" && value !== null
308− ? transform(value)
309− : undefined;
310−}