commonMain.neat.CollectionUtils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neat-validation-jvm Show documentation
Show all versions of neat-validation-jvm Show documentation
A collection library that is built with interoperability in mind
package neat
fun Collection>.aggregate(value: T): Validity {
val invalids = filterIsInstance>()
return if (invalids.isEmpty()) {
Valid(Unit)
} else {
Invalid(Unit, invalids.flatMap { it.reasons })
}.map { value }
}