diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-11-28 23:25:05 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-11-28 23:25:05 -0400 |
commit | 690a7b53a72ac71f9f76260fa50c634566c4e984 (patch) | |
tree | 841653cf0e474c6edd437ec36884f2130b5b7b43 /src/util | |
parent | ae9dba60c4bbb327b402c500cc042922a954de74 (diff) |
divide things.js into modular files (hilariously)
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/link.js | 27 | ||||
-rw-r--r-- | src/util/sugar.js | 6 |
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)}`; } |