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

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

There is a newer version: 1.0.1-pre.823
Show newest version
@file:Suppress("NOTHING_TO_INLINE")

package kotlinext.js

import kotlinx.js.Object

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

fun  clone(obj: T) = Object.assign(kotlinx.js.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 - 2025 Weber Informatics LLC | Privacy Policy