History

Sanity-check decaffeinate app.views.Content

Simon Legner committed 2 years ago

Commit 2dd04a81 parent 29b09161 file · +2 −25Browse files

Showing the changes to assets/javascripts (1 of 1 file). Show all

Unified · Split

assets/javascripts/views/content/content.js+2−25
@@ -1,16 +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− * DS104: Avoid inline assignments
8− * DS204: Change includes calls to have a more natural evaluation order
9− * DS205: Consider reworking code to avoid use of IIFEs
10− * DS206: Consider reworking classes to avoid initClass
11− * DS207: Consider shorter variations of null checks
12− * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
13− */
141 app.views.Content = class Content extends app.View {
152 static el = "._content";
163 static loadingClass = "_content-loading";
@@ -229,7 +216,7 @@ app.views.Content = class Content extends app.View { · 212 unmodified lines
229216 !document.activeElement ||
230217 !$.hasChild(this.el, document.activeElement)
231218 ) {
232− __guard__(this.find("a:not(:empty)"), (x) => x.focus());
219+ this.find("a:not(:empty)")?.focus();
233220 return $.stopEvent(event);
234221 }
235222 }
@@ -251,16 +238,6 @@ app.views.Content = class Content extends app.View { · 15 unmodified lines
251238 }
252239
253240 isExternalUrl(url) {
254− let needle;
255− return (
256− (needle = __guard__(url, (x) => x.slice(0, 6))),
257− ["http:/", "https:"].includes(needle)
258− );
241+ return url?.startsWith("http:") || url?.startsWith("https:");
259242 }
260243 };
261−
262−function __guard__(value, transform) {
263− return typeof value !== "undefined" && value !== null
264− ? transform(value)
265− : undefined;
266−}