From 4739ac5fae824c6c985fca9ae34f6335f5c9c13e Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 20 Jan 2024 16:32:56 -0400 Subject: data: inputThingClass -> isThingClass, use global Thing symbols --- src/data/things/validators.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/data/things') 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), -- cgit 1.3.0-6-gf8a5