Skip to content

Instantly share code, notes, and snippets.

@le0nidas
Last active August 26, 2019 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save le0nidas/80640046d14e19883e726e94c0c19c18 to your computer and use it in GitHub Desktop.
Save le0nidas/80640046d14e19883e726e94c0c19c18 to your computer and use it in GitHub Desktop.
fun validateEmailAddress(value: String): EmailAddress {
// does some validation and
// if the validation fails it returns InvalidEmailAddress
// otherwise a ValidEmailAddress
}
fun validatePassword(emailAddress: ValidEmailAddress, password: String): Password {
// does some validation against the valid email address
// if the validation fails it returns an InvalidPassword
// otherwise a ValidPassword
}
fun requestToken(emailAddress: ValidEmailAddress, password: ValidPassword): Token {
// having only valid values makes the code simple
// just make the request and return the token
return Token("some kind of token")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment