Do you know of any validation framework with Kotli...
# random
o
Do you know of any validation framework with Kotlin-friendly APIs? Or maybe someone wants to make one?
Copy code
val name = expression.validate {
   … some validation clauses…
}
So that there could be range checks, nullity, etc. I didn’t put any thought into it yet, but I feel the need in many places.
r
Sure:
Copy code
fun <T> T.validate(predicate: (T) -> Boolean): T {
    require(predicate(this))
    return this
}
🧌