History

Sanity-check decaffeinate app.templates.aboutPage

Simon Legner committed 2 years ago

Commit bcb6f891 parent b4cf7561 file · +8 −31Browse files

Unified · Split

assets/javascripts/templates/pages/about_tmpl.js+8−31
@@ -1,21 +1,9 @@
1−// TODO: This file was created by bulk-decaffeinate.
2−// Sanity-check the conversion and remove this comment.
3−/*
4− * decaffeinate suggestions:
5− * DS101: Remove unnecessary use of Array.from
6− * DS102: Remove unnecessary code created because of implicit returns
7− * DS205: Consider reworking code to avoid use of IIFEs
8− * DS207: Consider shorter variations of null checks
9− * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
10− */
111 app.templates.aboutPage = function () {
122 let doc;
13− const all_docs = app.docs
14− .all()
15− .concat(...Array.from(app.disabledDocs.all() || []));
3+ const all_docs = app.docs.all().concat(...(app.disabledDocs.all() || []));
164 // de-duplicate docs by doc.name
175 const docs = [];
18− for (doc of Array.from(all_docs)) {
6+ for (doc of all_docs) {
197 if (!docs.find((d) => d.name === doc.name)) {
208 docs.push(doc);
219 }
@@ -85,23 +73,12 @@ app.templates.aboutPage = function () { · 63 unmodified lines
8573 <th>Documentation
8674 <th>Copyright/License
8775 <th>Source code
88− ${(() => {
89− const result = [];
90−
91− for (doc of Array.from(docs)) {
92− result.push(`<tr> \
93−<td><a href=\"${doc.links != null ? doc.links.home : undefined}\">${
94− doc.name
95− }</a></td> \
96−<td>${doc.attribution}</td> \
97−<td><a href=\"${
98− doc.links != null ? doc.links.code : undefined
99− }\">Source code</a></td> \
100−</tr>`);
101− }
102−
103− return result;
104− })().join("")}
76+ ${docs
77+ .map(
78+ (doc) =>
79+ `<tr><td><a href="${doc.links?.home}">${doc.name}</a></td><td>${doc.attribution}</td><td><a href="${doc.links?.code}">Source code</a></td></tr>`,
80+ )
81+ .join("")}
10582 </table>
10683 </div>
10784