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 */
10app.Shortcuts = class Shortcuts extends Events {1app.Shortcuts = class Shortcuts extends Events {
11 constructor() {2 constructor() {
12 super();3 super();
@@ -215,13 +206,13 @@ app.Shortcuts = class Shortcuts extends Events { · 202 unmodified lines
215 this.trigger("pageUp");206 this.trigger("pageUp");
216 return false;207 return false;
217 case 38:208 case 38:
218 if (!__guard__(getSelection(), (x) => x.toString())) {209 if (!getSelection()?.toString()) {
219 this.trigger("altUp");210 this.trigger("altUp");
220 return false;211 return false;
221 }212 }
222 break;213 break;
223 case 40:214 case 40:
224 if (!__guard__(getSelection(), (x1) => x1.toString())) {215 if (!getSelection()?.toString()) {
225 this.trigger("altDown");216 this.trigger("altDown");
226 return false;217 return false;
227 }218 }
@@ -302,9 +293,3 @@ app.Shortcuts = class Shortcuts extends Events { · 74 unmodified lines
302 }293 }
303 }294 }
304};295};
305
306function __guard__(value, transform) {
307 return typeof value !== "undefined" && value !== null
308 ? transform(value)
309 : undefined;
310}