![JAR search and dependency download from the Maven repository](/logo.png)
commonMain.com.harmony.kotlin.common.either.EitherUtils.kt Maven / Gradle / Ivy
package com.harmony.kotlin.common.either
/**
* Transform a block of code into a Either
*/
inline fun eitherOf(block: () -> R): Either {
return try {
Either.Right(block())
} catch (e: Throwable) {
if (e is L) {
Either.Left(e)
} else {
throw e
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy