You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to check if a field is a valid email address OR if it's a valid username.
This is how I would do it normally in javascript:
if(value===undefined)returnfalse;// Check if value is undefined. If it is, return false.if(isEmail(value))returntrue;// If value isn't undefined, then check if it's a valid email address.if(value.match(/^[a-z0-9]+$/i))returntrue;// If value isn't an email, then it's got to be a username.returnfalse;// If value isn't an email address and not a username, then it's an invalid value.
How can I do the same in express-validator?
Note: the field is the same field, "username".
The text was updated successfully, but these errors were encountered:
I want to check if a field is a valid email address OR if it's a valid username.
This is how I would do it normally in javascript:
How can I do the same in express-validator?
Note: the field is the same field, "username".
The text was updated successfully, but these errors were encountered: