firstValidatingTo

fun <F, T> ConvertsFrom<F, T>.firstValidatingTo(validate: (T) -> Unit): ConvertsFrom<F, T>

Adds validation before a conversion by running validate on T values before converting them to type F. Validators are expected to throw an exception if the expected condition is not met.

Parameters

F

The type being converted to

T

The type being converted from

validate

A function which accepts a T value and throws an exception if the expected condition is not met