package mx.trackermap.TrackerMap.client.infrastructure typealias MultiValueMap = Map> fun collectionDelimiter(collectionFormat: String) = when (collectionFormat) { "csv" -> "," "tsv" -> "\t" "pipes" -> "|" "ssv" -> " " else -> "" } val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } fun toMultiValue(items: List, collectionFormat: String, map: (item: Any?) -> String = defaultMultiValueConverter): List { return when (collectionFormat) { "multi" -> items.map(map) else -> listOf(items.map(map).joinToString(separator = collectionDelimiter(collectionFormat))) } }