« get me outta code hell

external-links: cleaner per-style logic - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-23 20:47:34 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-24 13:45:35 -0400
commitba6c4e043b3364481ac3beff1e2a141d1bfcf6fb (patch)
tree0ec66b67837bc72a4a726243fe2d65e1c584424f /src/data
parent8c69ef2b14c4719fa0cd0c7daca27c613167b7ca (diff)
external-links: cleaner per-style logic
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/language.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js
index f83b4218..70481299 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -2,6 +2,7 @@ import {isLanguageCode} from '#validators';
 import {Tag} from '#html';
 
 import {
+  getExternalLinkStringOfStyleFromDescriptors,
   getExternalLinkStringsFromDescriptors,
   isExternalLinkContext,
   isExternalLinkSpec,
@@ -321,20 +322,19 @@ export class Language extends Thing {
       throw new TypeError(`externalLinkSpec unavailable`);
     }
 
-    if (style !== 'all') isExternalLinkStyle(style);
     isExternalLinkContext(context);
 
-    const results =
-      getExternalLinkStringsFromDescriptors(url, this.externalLinkSpec, {
+    if (style === 'all') {
+      return getExternalLinkStringsFromDescriptors(url, this.externalLinkSpec, {
         language: this,
         context,
       });
-
-    if (style === 'all') {
-      return results;
-    } else {
-      return results[style];
     }
+
+    return getExternalLinkStringOfStyleFromDescriptors(url, style, this.externalLinkSpec, {
+      language: this,
+      context,
+    });
   }
 
   formatIndex(value) {