Merge pull request #117 from InsanusMokrassar/0.8.6

0.8.6
This commit is contained in:
InsanusMokrassar 2021-12-08 15:57:43 +06:00 committed by GitHub
commit ed1baaade7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 0.8.6
* `Common`:
* `Either` extensions `onFirst` and `onSecond` now accept not `crossinline` callbacks
* All `joinTo` now accept not `crossinline` callbacks
## 0.8.5
* `Common`:

View File

@ -129,7 +129,7 @@ inline fun <T1, T2> Either.Companion.second(t2: T2): Either<T1, T2> = EitherSeco
/**
* Will call [block] in case when [Either.t1] of [this] is not null
*/
inline fun <T1, T2, E : Either<T1, T2>> E.onFirst(crossinline block: (T1) -> Unit): E {
inline fun <T1, T2, E : Either<T1, T2>> E.onFirst(block: (T1) -> Unit): E {
val t1 = t1
t1 ?.let(block)
return this
@ -138,7 +138,7 @@ inline fun <T1, T2, E : Either<T1, T2>> E.onFirst(crossinline block: (T1) -> Uni
/**
* Will call [block] in case when [Either.t2] of [this] is not null
*/
inline fun <T1, T2, E : Either<T1, T2>> E.onSecond(crossinline block: (T2) -> Unit): E {
inline fun <T1, T2, E : Either<T1, T2>> E.onSecond(block: (T2) -> Unit): E {
val t2 = t2
t2 ?.let(block)
return this

View File

@ -1,10 +1,10 @@
package dev.inmo.micro_utils.common
inline fun <I, R> Iterable<I>.joinTo(
crossinline separatorFun: (I) -> R?,
separatorFun: (I) -> R?,
prefix: R? = null,
postfix: R? = null,
crossinline transform: (I) -> R?
transform: (I) -> R?
): List<R> {
val result = mutableListOf<R>()
val iterator = iterator()
@ -29,11 +29,11 @@ inline fun <I, R> Iterable<I>.joinTo(
separator: R? = null,
prefix: R? = null,
postfix: R? = null,
crossinline transform: (I) -> R?
transform: (I) -> R?
): List<R> = joinTo({ separator }, prefix, postfix, transform)
inline fun <I> Iterable<I>.joinTo(
crossinline separatorFun: (I) -> I?,
separatorFun: (I) -> I?,
prefix: I? = null,
postfix: I? = null
): List<I> = joinTo<I, I>(separatorFun, prefix, postfix) { it }
@ -45,15 +45,15 @@ inline fun <I> Iterable<I>.joinTo(
): List<I> = joinTo<I>({ separator }, prefix, postfix)
inline fun <I, reified R> Array<I>.joinTo(
crossinline separatorFun: (I) -> R?,
separatorFun: (I) -> R?,
prefix: R? = null,
postfix: R? = null,
crossinline transform: (I) -> R?
transform: (I) -> R?
): Array<R> = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray()
inline fun <I, reified R> Array<I>.joinTo(
separator: R? = null,
prefix: R? = null,
postfix: R? = null,
crossinline transform: (I) -> R?
transform: (I) -> R?
): Array<R> = asIterable().joinTo(separator, prefix, postfix, transform).toTypedArray()

View File

@ -45,5 +45,5 @@ dokka_version=1.5.31
# Project data
group=dev.inmo
version=0.8.5
android_code_version=85
version=0.8.6
android_code_version=86