« get me outta code hell

bam (Thing subclasses: several steps, one file) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/thing/thing.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-02-12 17:38:27 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-02-12 17:40:01 -0400
commit95bd943d62473e53de11cd6368e540cd48e4231a (patch)
treea6e1f0a21222eaeb01a270d8202a31616903649b /src/thing/thing.js
parentcfa02cb03a363c46408db7f0ec54bd3a7e4ad018 (diff)
bam (Thing subclasses: several steps, one file)
Diffstat (limited to 'src/thing/thing.js')
-rw-r--r--src/thing/thing.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/thing/thing.js b/src/thing/thing.js
deleted file mode 100644
index 2d6def6..0000000
--- a/src/thing/thing.js
+++ /dev/null
@@ -1,62 +0,0 @@
-// Base class for Things. No, we will not come up with a better name.
-// Sorry not sorry! :)
-
-import CacheableObject from './cacheable-object.js';
-
-import {
-    validateArrayItems,
-} from './validators.js';
-
-import { getKebabCase } from '../util/wiki-data.js';
-import find from '../util/find.js';
-
-export default class Thing extends CacheableObject {
-    static referenceType = Symbol('Thing.referenceType');
-
-    static directoryExpose = {
-        dependencies: ['name'],
-        transform(directory, { name }) {
-            if (directory === null && name === null)
-                return null;
-            else if (directory === null)
-                return getKebabCase(name);
-            else
-                return directory;
-        }
-    };
-
-    static genContribsExpose(contribsByRefProperty) {
-        return {
-            dependencies: ['artistData', contribsByRefProperty],
-            compute: ({ artistData, [contribsByRefProperty]: contribsByRef }) => (
-                (contribsByRef && artistData
-                    ? (contribsByRef
-                        .map(({ who: ref, what }) => ({
-                            who: find.artist(ref, {wikiData: {artistData}}),
-                            what
-                        }))
-                        .filter(({ who }) => who))
-                    : [])
-            )
-        };
-    }
-
-    static genWikiDataProperty(thingClass) {
-        return {
-            flags: {update: true},
-            update: {
-                validate: validateArrayItems(x => x instanceof thingClass)
-            }
-        };
-    }
-
-    static getReference(thing) {
-        if (!thing.constructor[Thing.referenceType])
-            throw TypeError(`Passed Thing is ${thing.constructor.name}, which provides no [Thing.referenceType]`);
-
-        if (!thing.directory)
-            throw TypeError(`Passed ${thing.constructor.name} is missing its directory`);
-
-        return `${thing.constructor[Thing.referenceType]}:${thing.directory}`;
-    }
-}