update dependencies and devDependencies, fix lint issues
[websub-hub] / src / template / admin-overview-html.js
index 1ec3d110275d2197f20f9a239a6a4776922b84b6..fd0261f53c85618eb6310e1fdd53bf2115bacb27 100644 (file)
@@ -4,12 +4,12 @@ const th = require('./template-helper');
 
 /**
  * Show a summary of all topics.
- * @param {Object} ctx
- * @param {Object[]} ctx.topics
- * @param {Object} options
- * @param {Object} options.manager
- * @param {String} options.manager.pageTitle
- * @returns {String}
+ * @param {object} ctx context
+ * @param {object[]} ctx.topics topics
+ * @param {object} options options
+ * @param {object} options.manager manager options
+ * @param {string} options.manager.pageTitle page title
+ * @returns {string} html
  */
 module.exports = (ctx, options) => {
   const pageTitle = `${options.manager.pageTitle} - Topics`;
@@ -33,7 +33,7 @@ module.exports = (ctx, options) => {
     th.renderTopicRowHeader(),
     `          </thead>
         <tbody>`,
-    ...(ctx.topics && ctx.topics.map((topic) => th.renderTopicRow(topic, { length: topic.subscribers }))),
+    ...((ctx?.topics || []).map((topic) => th.renderTopicRow(topic, { length: topic.subscribers }))),
     `        </tbody>
         </table>
       </section>`,