diff options
Diffstat (limited to 'src/data/things')
-rw-r--r-- | src/data/things/validators.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js index d02e5f28..efe76fe0 100644 --- a/src/data/things/validators.js +++ b/src/data/things/validators.js @@ -595,6 +595,16 @@ export function isContentString(content) { return true; } +export function isThingClass(thingClass) { + isFunction(thingClass); + + if (!Object.hasOwn(thingClass, Symbol.for('Thing.referenceType'))) { + throw new TypeError(`Expected a Thing constructor, missing Thing.referenceType`); + } + + return true; +} + export const isContribution = validateProperties({ who: isArtistRef, what: optional(isStringNonEmpty), |