Skip to content

Commit ae602f0

Browse files
authoredSep 19, 2020
Remove typeof comparing to undefined
This comparison is invalid, because typeof always returns strings.
1 parent 1e4c8aa commit ae602f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/validate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
168168
if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){
169169
addError("must be at least " + schema.minLength + " characters long");
170170
}
171-
if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum &&
171+
if(typeof schema.minimum !== 'undefined' && typeof value == typeof schema.minimum &&
172172
schema.minimum > value){
173173
addError("must have a minimum value of " + schema.minimum);
174174
}
175-
if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum &&
175+
if(typeof schema.maximum !== 'undefined' && typeof value == typeof schema.maximum &&
176176
schema.maximum < value){
177177
addError("must have a maximum value of " + schema.maximum);
178178
}

0 commit comments

Comments
 (0)
Please sign in to comment.