Jonathan Lennox
07/02/2024, 6:43 PMJonathan Lennox
07/02/2024, 6:44 PMval data = rawData.split("\r\n", "\n")
.filter { it.isNotEmpty() }
.map { JSON.parse<dynamic>(it) }
.map {
if (it.data is String) {
val lineData = JSON.parse<dynamic>(it.data)
lineData.forEach { entry ->
it[entry.key] = entry.value
}
}
it
}
.toList()
Jonathan Lennox
07/02/2024, 6:44 PMe: /Users/jlennox/Git/jvb-dashboard/src/main/kotlin/DumpViewer.kt: (34, 45): Expected a value of type dynamic. Assignment operation is not an expression, so it does not return any value
on the forEach
. What am I doing wrong?Jonathan Lennox
07/02/2024, 6:45 PMObject.assign
in Kotlin/JS?Jonathan Lennox
07/02/2024, 6:48 PMjs("Object").assign(it, lineData)
worked, but I still don't understand what's wrong with the forEach
turansky
07/02/2024, 7:53 PMturansky
07/02/2024, 7:54 PMlineData
- Array
?Jonathan Lennox
07/02/2024, 8:03 PMturansky
07/02/2024, 8:10 PMforEach
methodJonathan Lennox
07/03/2024, 2:33 PMEdoardo Luppi
07/03/2024, 7:53 PM