diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-07-12 11:56:23 -0300 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-07-12 11:56:23 -0300 |
| commit | 6a713867ed1e8353ae6aacddc955ddd84389692d (patch) | |
| tree | 9ea360fbe85fdd8b8f068a92e9a40d5f9c1c6b27 /src/data | |
| parent | 9718fbc7b4c0c878856d5c492443c0e338930507 (diff) | |
checks, data, css: niceys
Diffstat (limited to 'src/data')
| -rw-r--r-- | src/data/checks.js | 9 | ||||
| -rw-r--r-- | src/data/thing.js | 21 |
2 files changed, 23 insertions, 7 deletions
diff --git a/src/data/checks.js b/src/data/checks.js index 88dfbc6d..fcafbaca 100644 --- a/src/data/checks.js +++ b/src/data/checks.js @@ -568,7 +568,16 @@ export function filterReferenceErrors(wikiData, { break; default: + if (findFnKey.startsWith('_')) { + throw new Error(`Unknown specially handled find function "${findFnKey}"`); + } + findFn = boundFind[findFnKey]; + + if (!findFn) { + throw new Error(`Unknown find function "${findFnKey}"`); + } + break; } diff --git a/src/data/thing.js b/src/data/thing.js index f5afe076..621dff5a 100644 --- a/src/data/thing.js +++ b/src/data/thing.js @@ -67,7 +67,11 @@ export default class Thing extends CacheableObject { name = colors.yellow(`couldn't get name`); } - let reference = Thing.inspectReference(this, {showConstructor: false}); + let reference = + Thing.inspectReference(this, { + showConstructor: false, + showName: false, + }); return ( (name ? `${constructorName} ${name}` : `${constructorName}`) + @@ -120,7 +124,10 @@ export default class Thing extends CacheableObject { return `${thing.constructor[Thing.referenceType]}:${thing.directory}`; } - static inspectReference(thing, {showConstructor = true} = {}) { + static inspectReference(thing, { + showConstructor = true, + showName = true, + } = {}) { const referenceType = thing.constructor[Thing.referenceType] ?? null; @@ -145,12 +152,12 @@ export default class Thing extends CacheableObject { if (directoryPart && referenceType) { return colors.blue(`${referenceType}:${directoryPart}`); - } else if (directoryPart) { - return constructorPart + `(${colors.blue(directoryPart)})`; - } else if (tryToGet('name')) { - return constructorPart + `(named ${inspect(thing.name)}`; + } if (directoryPart) { + return constructorPart + `${colors.blue(directoryPart)}`; + } else if (showName && tryToGet('name')) { + return constructorPart + `named ${inspect(thing.name)}`; } else if (errored && directoryErrored) { - return constructorPart + `(${colors.yellow(`couldn't compute reference`)})`; + return constructorPart + `${colors.yellow(`couldn't compute reference`)}`; } else { return constructorPart; } |