Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
fix(Formbot): Update minLength and maxLength error messages (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hurshal Patel authored and kylealwyn committed Dec 1, 2018
1 parent 9917201 commit ff0f468
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 75 deletions.
88 changes: 16 additions & 72 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"gh-pages": "^2.0.1",
"jest": "^23.6.0",
"jest-styled-components": "^6.2.1",
"npm-run-all": "^4.1.2",
"npm-run-all": "^4.1.5",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-router-dom": "^4.2.2",
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Formbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const VALIDATIONS = {
},
minLength: (val, minLength) => {
if (!val || `${val}`.length < minLength) {
throw new Error(`This field must be longer than ${minLength} characters`);
throw new Error(`This field must be at least ${minLength} characters`);
}
},
maxLength: (val, maxLength) => {
if (val && `${val}`.length > maxLength) {
throw new Error(`This field cannot be less than ${maxLength} characters`);
throw new Error(`This field cannot be more than ${maxLength} characters`);
}
},
};
Expand Down

0 comments on commit ff0f468

Please sign in to comment.