Skip to content

Commit b2b4edd

Browse files
authored
Merge pull request #53 from DanielAlt/master
(Issue 52) Bugfix for unexpected TypeError when maxLength rule receives undefined input
2 parents 0b083e7 + b40435b commit b2b4edd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rules/maxLength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function maxLength({ attr, value, args }) {
66
throw new Error(`Seed in maxLength rule for ${attr} must be a number.`);
77
}
88

9-
if (value.toString().length > parseInt(maxNum)) {
9+
if (value && value.toString().length > parseInt(maxNum)) {
1010
return false;
1111
}
1212

0 commit comments

Comments
 (0)