validateNotNull

fun <B> B?.validateNotNull(label: Option<String> = None): Either<Throwable, B>(source)

Turns a nullable value into an Either. This is useful for building validation functions.

Return

Either.Left if the value is null, Either.Right if the value is not null.

Parameters

label

Optional String to identify the nullable value being evaluated, used in the failure message.