« get me outta code hell

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:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/link.js27
-rw-r--r--src/util/sugar.js6
2 files changed, 11 insertions, 22 deletions
diff --git a/src/util/link.js b/src/util/link.js
index 41ac9131..bc3bd50a 100644
--- a/src/util/link.js
+++ b/src/util/link.js
@@ -11,16 +11,7 @@
 
 import * as html from './html.js';
 
-import {
-  Album,
-  Artist,
-  ArtTag,
-  Flash,
-  Group,
-  NewsEntry,
-  StaticPage,
-  Track,
-} from '../data/things.js';
+import T from '../data/things/index.js';
 
 export function unbound_getLinkThemeString(color, {
   getColors,
@@ -98,14 +89,14 @@ const linkIndex = (key, conf) =>
 // the given thing based on what it's an instance of. This is used for the
 // link.anything() function.
 const linkAnythingMapping = [
-  [Album, 'album'],
-  [Artist, 'artist'],
-  [ArtTag, 'tag'],
-  [Flash, 'flash'],
-  [Group, 'groupInfo'],
-  [NewsEntry, 'newsEntry'],
-  [StaticPage, 'staticPage'],
-  [Track, 'track'],
+  [T.Album, 'album'],
+  [T.Artist, 'artist'],
+  [T.ArtTag, 'tag'],
+  [T.Flash, 'flash'],
+  [T.Group, 'groupInfo'],
+  [T.NewsEntry, 'newsEntry'],
+  [T.StaticPage, 'staticPage'],
+  [T.Track, 'track'],
 ];
 
 const link = {
diff --git a/src/util/sugar.js b/src/util/sugar.js
index 808a7e1c..e8fdf932 100644
--- a/src/util/sugar.js
+++ b/src/util/sugar.js
@@ -405,7 +405,7 @@ export function _withAggregate(mode, aggregateOpts, fn) {
 }
 
 export function showAggregate(topError, {
-  pathToFile = (p) => p,
+  pathToFileURL = f => f,
   showTraces = true,
 } = {}) {
   const recursive = (error, {level}) => {
@@ -429,9 +429,7 @@ export function showAggregate(topError, {
         ? '- ' +
           stackLine
             .trim()
-            .replace(/file:\/\/(.*\.js)/, (match, pathname) =>
-              pathToFile(pathname)
-            )
+            .replace(/file:\/\/.*\.js/, (match) => pathToFileURL(match))
         : '(no stack trace)';
       header += ` ${color.dim(tracePart)}`;
     }