Created
January 10, 2021 23:07
-
-
Save hadilq/312ae73f4cde40d8558200b02935e467 to your computer and use it in GitHub Desktop.
Validate DSL extension function
This file contains 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
public inline infix fun ValidationResult.elseIf(build: ValidationResultElseIfBuilder.() -> Unit): | |
Success { | |
if (this is Success) { | |
return this | |
} else { | |
val builder = ValidationResultElseIfBuilder(this) | |
builder.build() | |
return builder.result | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment