diff --git a/source/basic.js b/source/basic.js index f6bd6aa..7f90d70 100644 --- a/source/basic.js +++ b/source/basic.js @@ -1,4 +1,7 @@ ValidatorContext.prototype.validateBasic = function validateBasic(data, schema, dataPointerPath) { + if (typeof data === "undefined") { + return null; + } var error; if (error = this.validateType(data, schema, dataPointerPath)) { return error.prefixWith(null, "type"); @@ -14,9 +17,6 @@ ValidatorContext.prototype.validateType = function validateType(data, schema) { return null; } var dataType = typeof data; - if (dataType === "undefined") { - return null; - } if (data === null) { dataType = "null"; } else if (Array.isArray(data)) {