From 2dea9f3bc0d9bacab61658bf8b0c820dd73a0232 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 10:08:28 +0600 Subject: [PATCH 1/9] start 0.5.23 --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6ab369bee77..cdc9648a2d6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -45,5 +45,5 @@ dokka_version=1.5.0 # Project data group=dev.inmo -version=0.5.22 -android_code_version=63 +version=0.5.23 +android_code_version=64 From e10504eeebe737370193dba4dc8c4c40ac54ad81 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 10:09:06 +0600 Subject: [PATCH 2/9] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9c6e12e271..0b91344fcc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.5.23 + ## 0.5.22 * `Versions` From 71f12f5f1936bcc05b74e99d0c5f4f45ec938072 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 10:09:45 +0600 Subject: [PATCH 3/9] Update exposed --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index cdc9648a2d6..09c465ae2d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx2g kotlin_version=1.5.30 kotlin_coroutines_version=1.5.1 kotlin_serialisation_core_version=1.2.2 -kotlin_exposed_version=0.33.1 +kotlin_exposed_version=0.34.1 ktor_version=1.6.3 From b70aa12be9965f38392889cbcff4b4bd0797b243 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 13:50:40 +0600 Subject: [PATCH 4/9] add joinTo --- CHANGELOG.md | 4 +++ .../dev/inmo/micro_utils/common/JoinTo.kt | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b91344fcc0..344166d8225 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.5.23 +* `Versions` +* `Common`: + * New extensions `Iterable#joinTo` and `Array#joinTo` + ## 0.5.22 * `Versions` diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt new file mode 100644 index 00000000000..553c4f77783 --- /dev/null +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt @@ -0,0 +1,33 @@ +package dev.inmo.micro_utils.common + +inline fun Iterable.joinTo( + crossinline separatorFun: (I) -> R?, + prefix: R?, + postfix: R?, + crossinline transform: (I) -> R? +): List { + val result = mutableListOf() + val iterator = iterator() + + prefix ?.let(result::add) + + while (iterator.hasNext()) { + val element = iterator.next() + result.add(transform(element) ?: continue) + + if (iterator.hasNext()) { + result.add(separatorFun(element) ?: continue) + } + } + + postfix ?.let(result::add) + + return result +} + +inline fun Array.joinTo( + crossinline separatorFun: (I) -> R?, + prefix: R?, + postfix: R?, + crossinline transform: (I) -> R? +): Array = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray() From 662f4d22a371b774586a77cdd95bccd80de2ff76 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 13:52:00 +0600 Subject: [PATCH 5/9] fill changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 344166d8225..2860bd4a4d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## 0.5.23 -* `Versions` +* `Versions`: + * `Exposed`: `0.33.1` -> `0.34.1` * `Common`: * New extensions `Iterable#joinTo` and `Array#joinTo` From 97fc1d6239c92d4edcdd12a0ae329218705d1fef Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 14:01:01 +0600 Subject: [PATCH 6/9] small addition to joinTo --- .../kotlin/dev/inmo/micro_utils/common/JoinTo.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt index 553c4f77783..ddff9db3da7 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt @@ -25,9 +25,23 @@ inline fun Iterable.joinTo( return result } +inline fun Iterable.joinTo( + separator: R?, + prefix: R?, + postfix: R?, + crossinline transform: (I) -> R? +): List = joinTo({ separator }, prefix, postfix, transform) + inline fun Array.joinTo( crossinline separatorFun: (I) -> R?, prefix: R?, postfix: R?, crossinline transform: (I) -> R? ): Array = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray() + +inline fun Array.joinTo( + separator: R?, + prefix: R?, + postfix: R?, + crossinline transform: (I) -> R? +): Array = asIterable().joinTo(separator, prefix, postfix, transform).toTypedArray() From 3dc68a7b8b31721a3bb4cd5026fc3e581ad838b8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 14:09:34 +0600 Subject: [PATCH 7/9] small addition to joinTo --- .../dev/inmo/micro_utils/common/JoinTo.kt | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt index ddff9db3da7..760c55f9219 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt @@ -2,8 +2,8 @@ package dev.inmo.micro_utils.common inline fun Iterable.joinTo( crossinline separatorFun: (I) -> R?, - prefix: R?, - postfix: R?, + prefix: R? = null, + postfix: R? = null, crossinline transform: (I) -> R? ): List { val result = mutableListOf() @@ -26,12 +26,26 @@ inline fun Iterable.joinTo( } inline fun Iterable.joinTo( - separator: R?, - prefix: R?, - postfix: R?, + separator: R? = null, + prefix: R? = null, + postfix: R? = null, crossinline transform: (I) -> R? ): List = joinTo({ separator }, prefix, postfix, transform) +inline fun Iterable.joinTo( + crossinline separatorFun: (I) -> I?, + prefix: I? = null, + postfix: I? = null, + crossinline transform: (I) -> I? +): List = joinTo(separatorFun, prefix, postfix, transform) + +inline fun Iterable.joinTo( + separator: I?, + prefix: I? = null, + postfix: I? = null, + crossinline transform: (I) -> I? +): List = joinTo({ separator }, prefix, postfix, transform) + inline fun Array.joinTo( crossinline separatorFun: (I) -> R?, prefix: R?, @@ -40,8 +54,8 @@ inline fun Array.joinTo( ): Array = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray() inline fun Array.joinTo( - separator: R?, - prefix: R?, - postfix: R?, + separator: R? = null, + prefix: R? = null, + postfix: R? = null, crossinline transform: (I) -> R? ): Array = asIterable().joinTo(separator, prefix, postfix, transform).toTypedArray() From 2644f279758ddbcb68897a482bdb6b43a557d63b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 14:16:02 +0600 Subject: [PATCH 8/9] small addition to joinTo --- .../kotlin/dev/inmo/micro_utils/common/JoinTo.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt index 760c55f9219..97845e14823 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt @@ -35,16 +35,14 @@ inline fun Iterable.joinTo( inline fun Iterable.joinTo( crossinline separatorFun: (I) -> I?, prefix: I? = null, - postfix: I? = null, - crossinline transform: (I) -> I? -): List = joinTo(separatorFun, prefix, postfix, transform) + postfix: I? = null +): List = joinTo(separatorFun, prefix, postfix) { it } inline fun Iterable.joinTo( separator: I?, prefix: I? = null, - postfix: I? = null, - crossinline transform: (I) -> I? -): List = joinTo({ separator }, prefix, postfix, transform) + postfix: I? = null +): List = joinTo({ separator }, prefix, postfix) inline fun Array.joinTo( crossinline separatorFun: (I) -> R?, From f6a06ee8ea92a2c9f1cca6ce3643fc604919ee68 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 14:33:35 +0600 Subject: [PATCH 9/9] small addition to joinTo --- .../commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt index 97845e14823..e6919928160 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt @@ -39,15 +39,15 @@ inline fun Iterable.joinTo( ): List = joinTo(separatorFun, prefix, postfix) { it } inline fun Iterable.joinTo( - separator: I?, + separator: I? = null, prefix: I? = null, postfix: I? = null ): List = joinTo({ separator }, prefix, postfix) inline fun Array.joinTo( crossinline separatorFun: (I) -> R?, - prefix: R?, - postfix: R?, + prefix: R? = null, + postfix: R? = null, crossinline transform: (I) -> R? ): Array = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray()