From ac862a9adedd779537f38dfa5a996ced84fc3b74 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 4 Mar 2024 18:10:10 -0400 Subject: validators: optimize validateWikiData, support no-referenceType --- src/data/thing.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/data/thing.js') diff --git a/src/data/thing.js b/src/data/thing.js index 706e893d..9a8cec91 100644 --- a/src/data/thing.js +++ b/src/data/thing.js @@ -17,6 +17,22 @@ export default class Thing extends CacheableObject { static yamlDocumentSpec = Symbol.for('Thing.yamlDocumentSpec'); static getYamlLoadingSpec = Symbol.for('Thing.getYamlLoadingSpec'); + static isThingConstructor = Symbol.for('Thing.isThingConstructor'); + static isThing = Symbol.for('Thing.isThing'); + + // To detect: + // Symbol.for('Thing.isThingConstructor') in constructor + static [Symbol.for('Thing.isThingConstructor')] = NaN; + + static [CacheableObject.propertyDescriptors] = { + // To detect: + // Object.hasOwn(object, Symbol.for('Thing.isThing')) + [Symbol.for('Thing.isThing')]: { + flags: {expose: true}, + expose: {compute: () => NaN}, + }, + }; + // Default custom inspect function, which may be overridden by Thing // subclasses. This will be used when displaying aggregate errors and other // command-line logging - it's the place to provide information useful in -- cgit 1.3.0-6-gf8a5