-
Notifications
You must be signed in to change notification settings - Fork 160
/
Object.kt
40 lines (35 loc) · 1.28 KB
/
Object.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package kotlinext.js
external interface PropertyDescriptor<T> {
var configurable: Boolean
var enumerable: Boolean
var value: T
var writable: Boolean
var get: () -> T
var set: (v: T) -> Unit
}
external interface JsObject {
fun toLocaleString(): String
fun valueOf(): dynamic
fun hasOwnProperty(v: String): Boolean
fun isPrototypeOf(v: Any): Boolean
fun propertyIsEnumerable(v: String): Boolean
}
fun Any.asJsObject() = this as JsObject
external object Object {
fun <P, T : P> getPrototypeOf(o: T): P?
fun <T> getOwnPropertyDescriptor(o: Any, p: String): PropertyDescriptor<T>
fun getOwnPropertyNames(o: Any): Array<String>
fun create(o: Nothing?, properties: dynamic = definedExternally): Any
fun <T> create(o: T, properties: dynamic = definedExternally): T
fun <T, P> defineProperty(o: T, p: String, attributes: PropertyDescriptor<P>): T
fun <T> defineProperties(o: T, properties: dynamic): T
fun <T> seal(o: T): T
fun <R, T : R> freeze(o: T): R
fun <T> preventExtensions(o: T): T
fun isSealed(o: Any): Boolean
fun isFrozen(o: Any): Boolean
fun isExtensible(o: Any): Boolean
fun keys(o: Any): Array<String>
}
@JsModule("core-js/library/fn/object/assign")
external fun <T, R : T> assign(dest: R, src: T): R