Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require("json-schema/lib/validate").coerce = function(instance, schema){
switch(schema.type){
case "string":
instance = instance ? instance.toString() : "";
break;
case "number":
if(!isNaN(instance)){
instance = +instance;
}
break;
case "boolean":
instance = !!instance;
break;
case "null":
instance = null;
break;
case "object":