add kdocs to koin common module

This commit is contained in:
2025-04-14 10:03:26 +06:00
parent 5ec0a46089
commit 9c463d0338
8 changed files with 122 additions and 4 deletions

View File

@@ -3,6 +3,23 @@ package dev.inmo.micro_utils.koin
import org.koin.core.Koin
import org.koin.core.scope.Scope
/**
* Retrieves the first available instance of type [T] from the current scope.
* This is useful when you need any instance of a type and don't care which one.
*
* @param T The type of instance to retrieve
* @return The first available instance of type [T]
* @throws NoSuchElementException if no instances of type [T] are available
*/
inline fun <reified T : Any> Scope.getAny() = getAll<T>().first()
/**
* Retrieves the first available instance of type [T] from the Koin container.
* This is useful when you need any instance of a type and don't care which one.
*
* @param T The type of instance to retrieve
* @return The first available instance of type [T]
* @throws NoSuchElementException if no instances of type [T] are available
*/
inline fun <reified T : Any> Koin.getAny() = getAll<T>().first()