Skip to content

Commit

Permalink
Merge pull request #81 from hodovani/patch-1
Browse files Browse the repository at this point in the history
Remove typeof comparing to undefined
  • Loading branch information
kriszyp committed Sep 19, 2020
2 parents 1e4c8aa + ae602f0 commit 7dff9cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/validate.js
Expand Up @@ -168,11 +168,11 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){
addError("must be at least " + schema.minLength + " characters long");
}
if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum &&
if(typeof schema.minimum !== 'undefined' && typeof value == typeof schema.minimum &&
schema.minimum > value){
addError("must have a minimum value of " + schema.minimum);
}
if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum &&
if(typeof schema.maximum !== 'undefined' && typeof value == typeof schema.maximum &&
schema.maximum < value){
addError("must have a maximum value of " + schema.maximum);
}
Expand Down

0 comments on commit 7dff9cd

Please sign in to comment.