« get me outta code hell

remove a bunch of unnecessary guarding ?. - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/misc-templates.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-11-21 22:29:39 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-21 22:29:39 -0400
commit768927503b5948b846b9a6cddf4b788ca9792e8c (patch)
treec59259866e251d8177083212fe5571bcc7294895 /src/misc-templates.js
parenta69bdd2c6c02286f63ce19812ed42c4576423c3d (diff)
remove a bunch of unnecessary guarding ?.
Diffstat (limited to 'src/misc-templates.js')
-rw-r--r--src/misc-templates.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 7b4ef57..c627533 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -8,7 +8,10 @@ import {Track, Album} from './data/things.js';
 
 import {getColors} from './util/colors.js';
 
-import {unique} from './util/sugar.js';
+import {
+  empty,
+  unique,
+} from './util/sugar.js';
 
 import {
   getTotalDuration,
@@ -26,7 +29,7 @@ function unbound_generateAdditionalFilesShortcut(additionalFiles, {
   html,
   language,
 }) {
-  if (!additionalFiles?.length) return '';
+  if (empty(additionalFiles)) return '';
 
   return language.$('releaseInfo.additionalFiles.shortcut', {
     anchorLink:
@@ -45,7 +48,7 @@ function unbound_generateAdditionalFilesList(additionalFiles, {
   getFileSize,
   linkFile,
 }) {
-  if (!additionalFiles?.length) return [];
+  if (empty(additionalFiles)) return [];
 
   const fileCount = additionalFiles.flatMap((g) => g.files).length;
 
@@ -103,7 +106,7 @@ function unbound_getArtistString(artists, {
       const {urls} = who;
 
       const hasContribPart = !!(showContrib && what);
-      const hasExternalPart = !!(showIcons && urls?.length);
+      const hasExternalPart = !!(showIcons && !empty(urls));
 
       const artistLink = link.artist(who);
 
@@ -377,7 +380,7 @@ function unbound_generateTrackListDividedByGroups(tracks, {
 }) {
   const {divideTrackListsByGroups: groups} = wikiData.wikiInfo;
 
-  if (!groups?.length) {
+  if (empty(groups)) {
     return html.tag('ul',
       tracks.map(t => getTrackItem(t)));
   }