« get me outta code hell

external-links: don't hard-code styles where unnecessary - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-29 18:42:11 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-03-29 20:10:12 -0300
commitaaeffb2fe2d2e169cf92da5142037214ac341219 (patch)
tree60221613115b972d84cfb802d138abc0443bc8bd /src/util
parentd0fda4429c4f71cbc308296acf86dec506f32b8b (diff)
external-links: don't hard-code styles where unnecessary
Diffstat (limited to 'src/util')
-rw-r--r--src/util/external-links.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/util/external-links.js b/src/util/external-links.js
index 4dc95921..877ef8d4 100644
--- a/src/util/external-links.js
+++ b/src/util/external-links.js
@@ -897,15 +897,13 @@ export function getExternalLinkStringOfStyleFromDescriptors(url, style, descript
 }
 
 export function getExternalLinkStringsFromDescriptor(url, descriptor, {language}) {
-  const getStyle = style =>
-    getExternalLinkStringOfStyleFromDescriptor(url, style, descriptor, {language});
-
-  return {
-    'normal': getStyle('normal'),
-    'compact': getStyle('compact'),
-    'platform': getStyle('platform'),
-    'icon-id': getStyle('icon-id'),
-  };
+  return (
+    Object.fromEntries(
+      externalLinkStyles.map(style =>
+        getExternalLinkStringOfStyleFromDescriptor(
+          url,
+          style,
+          descriptor, {language}))));
 }
 
 export function getExternalLinkStringsFromDescriptors(url, descriptors, {