Created
November 8, 2018 12:00
-
-
Save cbrannen9a/852486eefa59c0de0ecb8cdf10a1a1ad to your computer and use it in GitHub Desktop.
Partial field validator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fieldValidator = (name, value) => { | |
let valid = false; | |
let message = ''; | |
switch (name) { | |
case 'firstName': | |
valid = value.trim().length > 0; | |
message = validatorMessage( | |
valid, | |
'Please enter a First Name'); | |
break; | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment