Skip to content

Instantly share code, notes, and snippets.

@dcampogiani
Created January 7, 2018 14:24
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 dcampogiani/619ee31c4dd3b84cf17f137688a56a8e to your computer and use it in GitHub Desktop.
Save dcampogiani/619ee31c4dd3b84cf17f137688a56a8e to your computer and use it in GitHub Desktop.
fun String.optionMail(): Option<String> =
when {
validMail(this) -> this.some()
else -> Option.None
}
fun String.optionPhoneNumber(): Option<String> =
when {
validNumber(this) -> this.some()
else -> Option.None
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment