@interweave/interweave
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -169,3 +169,3 @@ "use strict"; | ||
}); | ||
console.log("E: ", errorsObj); | ||
console.log("E: ", errorsObj === null || errorsObj === void 0 ? void 0 : errorsObj.keys); | ||
// (async () => { | ||
@@ -172,0 +172,0 @@ // try { |
@@ -239,3 +239,3 @@ "use strict"; | ||
// Handle config.schema saying array instad of object | ||
error(`Key '${key}' was specified as type ${schemaType} but received ${typeof value}.`); | ||
error(`Key '${key}' was specified as type ${schemaType} but received ${Array.isArray(value) ? "array" : typeof value}.`); | ||
} | ||
@@ -276,4 +276,6 @@ // Make sure objects and their keys obey the rules | ||
} | ||
if (!config.schema.enum.includes(value)) { | ||
error(`Key '${key}' expected a specfic value from the specified enum. Instead received '${value}'.`); | ||
if (!Array.isArray(value)) { | ||
if (!config.schema.enum.includes(value)) { | ||
error(`Key '${key}' expected a specfic value from the specified enum. Instead received '${value}'.`); | ||
} | ||
} | ||
@@ -280,0 +282,0 @@ } |
{ | ||
"name": "@interweave/interweave", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -337,3 +337,5 @@ import { isEmpty, isValuePresent } from "./helpers"; | ||
error( | ||
`Key '${key}' was specified as type ${schemaType} but received ${typeof value}.` | ||
`Key '${key}' was specified as type ${schemaType} but received ${ | ||
Array.isArray(value) ? "array" : typeof value | ||
}.` | ||
); | ||
@@ -383,6 +385,9 @@ } | ||
} | ||
if (!(config.schema.enum as any[]).includes(value)) { | ||
error( | ||
`Key '${key}' expected a specfic value from the specified enum. Instead received '${value}'.` | ||
); | ||
if (!Array.isArray(value)) { | ||
if (!(config.schema.enum as any[]).includes(value)) { | ||
error( | ||
`Key '${key}' expected a specfic value from the specified enum. Instead received '${value}'.` | ||
); | ||
} | ||
} | ||
@@ -389,0 +394,0 @@ } |
82773
2319