Sanity-check decaffeinate app.templates.helpPage

pull/1441/head
Simon Legner 1 year ago
parent bcb6f896b5
commit 3ea1050e17

@ -1,26 +1,12 @@
// 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
* DS205: Consider reworking code to avoid use of IIFEs
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.templates.helpPage = function () { app.templates.helpPage = function () {
let key, value;
const ctrlKey = $.isMac() ? "cmd" : "ctrl"; const ctrlKey = $.isMac() ? "cmd" : "ctrl";
const navKey = $.isMac() ? "cmd" : "alt"; const navKey = $.isMac() ? "cmd" : "alt";
const arrowScroll = app.settings.get("arrowScroll"); const arrowScroll = app.settings.get("arrowScroll");
const aliases_one = {}; const aliases = Object.entries(app.models.Entry.ALIASES);
const aliases_two = {}; const middle = Math.ceil(aliases.length / 2);
const keys = Object.keys(app.models.Entry.ALIASES); const aliases_one = aliases.slice(0, middle);
const middle = Math.ceil(keys.length / 2) - 1; const aliases_two = aliases.slice(middle);
for (let i = 0; i < keys.length; i++) {
key = keys[i];
(i > middle ? aliases_two : aliases_one)[key] =
app.models.Entry.ALIASES[key];
}
return `\ return `\
<nav class="_toc" role="directory"> <nav class="_toc" role="directory">
@ -169,31 +155,23 @@ app.templates.helpPage = function () {
<tr> <tr>
<th>Word <th>Word
<th>Alias <th>Alias
${(() => { ${aliases_one
const result = []; .map(
for (key in aliases_one) { ([key, value]) =>
value = aliases_one[key];
result.push(
`<tr><td class=\"_code\">${key}<td class=\"_code\">${value}`, `<tr><td class=\"_code\">${key}<td class=\"_code\">${value}`,
); )
} .join("")}
return result;
})().join("")}
</table> </table>
<table> <table>
<tr> <tr>
<th>Word <th>Word
<th>Alias <th>Alias
${(() => { ${aliases_two
const result1 = []; .map(
for (key in aliases_two) { ([key, value]) =>
value = aliases_two[key];
result1.push(
`<tr><td class=\"_code\">${key}<td class=\"_code\">${value}`, `<tr><td class=\"_code\">${key}<td class=\"_code\">${value}`,
); )
} .join("")}
return result1;
})().join("")}
</table> </table>
</div> </div>
<p>Feel free to suggest new aliases on <a href="https://github.com/freeCodeCamp/devdocs/issues/new">GitHub</a>.\ <p>Feel free to suggest new aliases on <a href="https://github.com/freeCodeCamp/devdocs/issues/new">GitHub</a>.\

Loading…
Cancel
Save