From 9c53af4cebcb264d449b51a3b0c54b9acac7539c Mon Sep 17 00:00:00 2001 From: TheFruxz Date: Tue, 7 Dec 2021 11:18:07 +0100 Subject: [PATCH 1/2] Feature: enhanced if extension functions --- JET-JVM/src/main/kotlin/de/jet/jvm/extension/Developer.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/JET-JVM/src/main/kotlin/de/jet/jvm/extension/Developer.kt b/JET-JVM/src/main/kotlin/de/jet/jvm/extension/Developer.kt index d4420f54c3..0e4b167ee3 100644 --- a/JET-JVM/src/main/kotlin/de/jet/jvm/extension/Developer.kt +++ b/JET-JVM/src/main/kotlin/de/jet/jvm/extension/Developer.kt @@ -67,9 +67,12 @@ fun empty() { } /** * Returns the [this]<[T]> modified with the [process] if [modifyIf] is true, */ -fun T?.applyIfNull(process: (T?) -> Unit) = isNull.switchResult(this.apply(process), this) -fun T?.applyIfNotNull(process: (T) -> Unit) = isNotNull.switchResult(this.forceCast().apply(process), this) +fun T?.applyIfNull(process: (T?) -> Unit) = modifyIf(isNull, process) + +fun T?.applyIfNotNull(process: (T) -> Unit) = modifyIf(isNotNull) { + process(this!!) +} fun T?.ifNull(process: () -> Unit) = if (isNull) process() else empty() From 0f3890b55a667b94526ae9fbcd94d8f9365df704 Mon Sep 17 00:00:00 2001 From: TheFruxz Date: Tue, 7 Dec 2021 11:18:43 +0100 Subject: [PATCH 2/2] Chore(version): update to BETA-8.1b for release --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 54d52a0cb3..27809eec97 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ plugins { allprojects { group = "de.jet" - version = "1.0-BETA-8.1" + version = "1.0-BETA-8.1b" repositories { mavenCentral()