« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/thing/validators.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/thing/validators.js')
-rw-r--r--src/thing/validators.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/thing/validators.js b/src/thing/validators.js
index 1bc7fd72..83922229 100644
--- a/src/thing/validators.js
+++ b/src/thing/validators.js
@@ -96,7 +96,7 @@ export function isStringNonEmpty(value) {
 
 // Complex types (non-primitives)
 
-function isInstance(value, constructor) {
+export function isInstance(value, constructor) {
     isObject(value);
 
     if (!(value instanceof constructor))
@@ -133,7 +133,11 @@ export function isArray(value) {
 function validateArrayItemsHelper(itemValidator) {
     return (item, index) => {
         try {
-            itemValidator(item);
+            const value = itemValidator(item);
+
+            if (value !== true) {
+                throw new Error(`Expected validator to return true`);
+            }
         } catch (error) {
             error.message = `(index: ${color.green(index)}, item: ${inspect(item)}) ${error.message}`;
             throw error;