Created
November 7, 2022 06:01
-
-
Save asissuthar/75e8b3b87c6a4bc4f3503461d3eca309 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
// ... | |
// Validate extention function for collection of FormFields. It will execute validate method of each field and return boolean result. | |
suspend fun Collection<FormField<*>>.validate(validateAll: Boolean = false) = coroutineScope { | |
if (validateAll) { | |
map { formField -> async { formField.validate(focusIfError = false) } }.awaitAll().all { result -> result } | |
} else { | |
all { formField -> formField.validate() } | |
} | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment