Created
June 24, 2020 20:51
-
-
Save Foso/f254410ba99722101b000e03181c4f45 to your computer and use it in GitHub Desktop.
KotlinJs get entries from Dict<T>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun entriesOf(jsObject: dynamic): List<Pair<String, Any?>> = | |
(js("Object.entries") as (dynamic) -> Array<Array<Any?>>) | |
.invoke(jsObject) | |
.map { entry -> entry[0] as String to entry[1] } | |
fun mapEntriesOf(jsObject: dynamic): Map<String, Any?> = | |
entriesOf(jsObject).toMap() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment