From 768927503b5948b846b9a6cddf4b788ca9792e8c Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 21 Nov 2022 22:29:39 -0400 Subject: remove a bunch of unnecessary guarding ?. --- src/misc-templates.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/misc-templates.js') 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))); } -- cgit 1.3.0-6-gf8a5