diff --git a/README.md b/README.md index fc5a33d..acbe540 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Maven gg.flyte twilight - 1.0.15 + 1.0.16 ``` @@ -29,14 +29,14 @@ maven { url "https://repo.flyte.gg/releases" } -implementation "gg.flyte:twilight:1.0.15" +implementation "gg.flyte:twilight:1.0.16" ``` Gradle (Kotlin DSL) ```kotlin maven("https://repo.flyte.gg/releases") -implementation("gg.flyte:twilight:1.0.15") +implementation("gg.flyte:twilight:1.0.16") ``` Certain features of Twilight require configuration, which can be done via the Twilight class. To setup a Twilight class instance, you can use the `twilight` method as shown below: diff --git a/build.gradle.kts b/build.gradle.kts index a1c6ab4..ca0ee76 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "gg.flyte" -version = "1.0.15" +version = "1.0.16" repositories { mavenCentral() diff --git a/src/main/kotlin/gg/flyte/twilight/extension/Collection.kt b/src/main/kotlin/gg/flyte/twilight/extension/Collection.kt new file mode 100644 index 0000000..aaf5b40 --- /dev/null +++ b/src/main/kotlin/gg/flyte/twilight/extension/Collection.kt @@ -0,0 +1,14 @@ +package gg.flyte.twilight.extension + +/** + * Applies the specified action to each element in the iterable. + * + * This extension function iterates through the elements of the iterable and + * applies the given action to each element, allowing for in-place modification + * or transformation of the elements. + * + * @param action The lambda function to apply to each element. + */ +inline fun Iterable.applyForEach(action: T.() -> Unit) { + forEach { it.action() } +} diff --git a/src/test/kotlin/gg/flyte/twilight/CollectionTest.kt b/src/test/kotlin/gg/flyte/twilight/CollectionTest.kt new file mode 100644 index 0000000..8ae4069 --- /dev/null +++ b/src/test/kotlin/gg/flyte/twilight/CollectionTest.kt @@ -0,0 +1,10 @@ +package gg.flyte.twilight + +import gg.flyte.twilight.extension.applyForEach + +fun main() { + val list = listOf("test", "asd", "34534534asd", "asdas2sd") + list.applyForEach { + println(this) + } +} \ No newline at end of file