NewOldMax / react-form-validator-core

Core validator component for react forms
MIT License
95 stars 44 forks source link

isEmail should return false if the value passed is "" #34

Closed eliassotodo closed 5 years ago

eliassotodo commented 5 years ago

Hey there, since "" is not a valid email, one would expect that isEmail("") return false instead of true.

NewOldMax commented 5 years ago

Hi, if you want to validate empty values, you can use required validation or create your own.

Example: you have optional email field. If isEmail("") throws false, so you will not submit form, because isEmail requires some value and it's not a responsibility of isEmail, you just want to submit form with empty email field (because email not required)