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

jsMain.kotlinext.js.Helpers.kt Maven / Gradle / Ivy

There is a newer version: 1.0.1-pre.808
Show newest version
package kotlinext.js

import js.core.Object
import js.core.jso

inline fun js(builder: dynamic.() -> Unit): dynamic =
    jso(builder)

fun  clone(obj: T) = Object.assign(jso(), obj)

inline fun  assign(obj: T, builder: T.() -> Unit) = clone(obj).apply(builder)

fun toPlainObjectStripNull(obj: Any) = js {
    for (key in Object.keys(obj)) {
        val value = obj.asDynamic()[key]
        if (value != null) this[key] = value
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy