All Downloads are FREE. Search and download functionalities are using the official Maven repository.

util.Variant.kt Maven / Gradle / Ivy

The newest version!
package com.amplitude.experiment.util

import com.amplitude.experiment.Variant
import com.amplitude.experiment.evaluation.EvaluationVariant

internal fun EvaluationVariant.toVariant(): Variant =
    Variant(value?.toString(), payload, key, metadata)

internal fun Map.toVariants(): Map =
    mapValues { it.value.toVariant() }

internal fun Map.filterDefaultVariants(): Map =
    filter { entry ->
        val default = entry.value.metadata?.get("default") as? Boolean ?: false
        val deployed = entry.value.metadata?.get("deployed") as? Boolean ?: true
        (!default && deployed)
    }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy