commonMain.internal.actions.HasAction.kt Maven / Gradle / Ivy
package io.kform.internal.actions
import io.kform.AbsolutePath
import io.kform.FormManager
import kotlinx.coroutines.flow.firstOrNull
/** Action that returns whether a value exists matching [path]. */
internal class HasAction(formManager: FormManager, path: AbsolutePath) :
ReadValueStateAction(formManager, path) {
override fun toString() = "Has($path)"
override suspend fun run() = valueInfo(path).firstOrNull() != null
}