Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.isValidEmailAddress = function(value) {
if (!value) {
return false;
}
const parts = value.split('@');
if (parts.length !== 2 || parts[1].length > 255) {
return false;
}
if (!EMAIL_USER.test(punycode.toASCII(parts[0]))) {
return false;
}
if (!EMAIL_DOMAIN.test(punycode.toASCII(parts[1]))) {
return false;
}
return true;
};
module.exports.isValidEmailAddress = function(value) {
if (! value) {
return false;
}
const parts = value.split('@');
if (parts.length !== 2 || parts[1].length > 255) {
return false;
}
if (! EMAIL_USER.test(punycode.toASCII(parts[0]))) {
return false;
}
if (! EMAIL_DOMAIN.test(punycode.toASCII(parts[1]))) {
return false;
}
return true;
};