« get me outta code hell

validators: creator & creatorMeta utility functions - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-12-30 15:11:20 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-12-30 15:11:20 -0400
commitc3e8199a6ab1305bcc528861bf71d37098dee947 (patch)
treed4351035b4d54da21fb5809892011ce4ca244359 /src
parentb6760d9d400b469875b9ecb034ff7e8d3b161385 (diff)
validators: creator & creatorMeta utility functions
Diffstat (limited to 'src')
-rw-r--r--src/data/things/validators.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index ac91b456..94c73b2a 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -12,6 +12,20 @@ function inspect(value) {
   return nodeInspect(value, {colors: ENABLE_COLOR});
 }
 
+export function getValidatorCreator(validator) {
+  return validator[Symbol.for(`hsmusic.validator.creator`)] ?? null;
+}
+
+export function getValidatorCreatorMeta(validator) {
+  return validator[Symbol.for(`hsmusic.validator.creatorMeta`)] ?? null;
+}
+
+export function setValidatorCreatorMeta(validator, creator, meta) {
+  validator[Symbol.for(`hsmusic.validator.creator`)] = creator;
+  validator[Symbol.for(`hsmusic.validator.creatorMeta`)] = meta;
+  return validator;
+}
+
 // Basic types (primitives)
 
 export function a(noun) {