Created
September 8, 2017 21:18
-
-
Save JoaoCnh/c53ef50b52d4515a0fbefb0bc72f1439 to your computer and use it in GitHub Desktop.
Yup Validation 2
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
Yup.object().shape({ | |
email: Yup.string().email('Invalid email address').required('Email is required!'), | |
username: Yup.string().required('This man needs a ${path}').when('email', (email, schema) => { | |
if (email === '[email protected]') { | |
return schema.label('papidipupi').min(10); | |
} | |
return schema.label('babidibiba'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment