Closed LVMVRQUXL closed 1 year ago
For all types, add builder variants suffixed with orThrow and orNull. Here's an example for NotBlankString, NonZeroInt and NotEmptyList types:
orThrow
orNull
NotBlankString
NonZeroInt
NotEmptyList
fun String.toNotBlankStringOrThrow(): NotBlankString = TODO() fun String.toNotBlankStringOrNull(): NotBlankString? = TODO() fun Int.toNonZeroIntOrThrow(): NonZeroInt = TODO() fun Int.toNonZeroIntOrNull(): NonZeroInt? = TODO() fun <E> Collection<E>.toNotEmptyListOrThrow(): NotEmptyList<E> = TODO() fun <E> Collection<E>.toNotEmptyListOrNull(): NotEmptyList<E>? = TODO()
PositiveInt
NegativeInt
StrictlyPositiveInt
StrictlyNegativeInt
NotEmptySet
NotEmptyMap
Work in progress
These operations brings more complexity than value and can be replaced by the existing API of kotlin.Result.
kotlin.Result
Description
For all types, add builder variants suffixed with
orThrow
andorNull
. Here's an example forNotBlankString
,NonZeroInt
andNotEmptyList
types:Checklist
NotBlankString
type.NonZeroInt
type.PositiveInt
type.NegativeInt
type.StrictlyPositiveInt
type.StrictlyNegativeInt
type.NotEmptyList
type.NotEmptySet
type.NotEmptyMap
type.Work in progress
section in changelog.