Created
May 16, 2020 20:12
-
-
Save lu4nm3/b3bcca1d279f2fe6a20a01508cb9a133 to your computer and use it in GitHub Desktop.
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
def apply(emailAddress: String): Either[String, EmailAddress] = { | |
if (isValidAddress(emailAddress)) { | |
Right(new EmailAddress(emailAddress)) | |
} else { | |
Left("Invalid email address") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment