mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Sanity-check decaffeinate app.views.Content
This commit is contained in:
parent
29b0916af0
commit
2dd04a82d8
1 changed files with 2 additions and 25 deletions
|
@ -1,16 +1,3 @@
|
|||
// 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
|
||||
* DS104: Avoid inline assignments
|
||||
* DS204: Change includes calls to have a more natural evaluation order
|
||||
* DS205: Consider reworking code to avoid use of IIFEs
|
||||
* DS206: Consider reworking classes to avoid initClass
|
||||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
||||
*/
|
||||
app.views.Content = class Content extends app.View {
|
||||
static el = "._content";
|
||||
static loadingClass = "_content-loading";
|
||||
|
@ -229,7 +216,7 @@ app.views.Content = class Content extends app.View {
|
|||
!document.activeElement ||
|
||||
!$.hasChild(this.el, document.activeElement)
|
||||
) {
|
||||
__guard__(this.find("a:not(:empty)"), (x) => x.focus());
|
||||
this.find("a:not(:empty)")?.focus();
|
||||
return $.stopEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -251,16 +238,6 @@ app.views.Content = class Content extends app.View {
|
|||
}
|
||||
|
||||
isExternalUrl(url) {
|
||||
let needle;
|
||||
return (
|
||||
(needle = __guard__(url, (x) => x.slice(0, 6))),
|
||||
["http:/", "https:"].includes(needle)
|
||||
);
|
||||
return url?.startsWith("http:") || url?.startsWith("https:");
|
||||
}
|
||||
};
|
||||
|
||||
function __guard__(value, transform) {
|
||||
return typeof value !== "undefined" && value !== null
|
||||
? transform(value)
|
||||
: undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue