« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/external-links.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/util/external-links.js b/src/util/external-links.js
index f63b9244..0c6e9d59 100644
--- a/src/util/external-links.js
+++ b/src/util/external-links.js
@@ -612,6 +612,16 @@ export function getExternalLinkStringOfStyleFromDescriptor(url, style, descripto
     return urlParts(url).domain;
   }
 
+  function getCompactDomain() {
+    const domain = getDomain();
+
+    if (!domain) {
+      return null;
+    }
+
+    return language.sanitize(domain.replace(/^www\./, ''));
+  }
+
   function getCustom() {
     if (!descriptor.custom) {
       return null;
@@ -679,13 +689,7 @@ export function getExternalLinkStringOfStyleFromDescriptor(url, style, descripto
     }
 
     if (descriptor.compact === 'domain') {
-      const domain = getDomain();
-
-      if (!domain) {
-        return null;
-      }
-
-      return language.sanitize(domain.replace(/^www\./, ''));
+      return getCompactDomain();
     }
 
     if (descriptor.compact === 'handle') {