« get me outta code hell

infra, data: allow exporting non-classes from things/ files - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-07 09:38:26 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-07 09:38:26 -0300
commitff6d14354612a9da430d523fa9dbc237cae3a6e2 (patch)
treed0f360fad34edda292b5f372df7366105794bf16
parentc6ba294c4fef425074f2352b640cc02c4768ee6e (diff)
infra, data: allow exporting non-classes from things/ files
-rw-r--r--src/data/things/index.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/data/things/index.js b/src/data/things/index.js
index 591cdc3..2d4f77d 100644
--- a/src/data/things/index.js
+++ b/src/data/things/index.js
@@ -82,6 +82,8 @@ function errorDuplicateClassNames() {
 function flattenClassLists() {
   for (const classes of Object.values(allClassLists)) {
     for (const [name, constructor] of Object.entries(classes)) {
+      if (typeof constructor !== 'function') continue;
+      if (!(constructor.prototype instanceof Thing)) continue;
       allClasses[name] = constructor;
     }
   }