diff --git a/jso/apis/src/main/java/org/teavm/jso/core/JSArray.java b/jso/apis/src/main/java/org/teavm/jso/core/JSArray.java index b62178a51..206a36e90 100644 --- a/jso/apis/src/main/java/org/teavm/jso/core/JSArray.java +++ b/jso/apis/src/main/java/org/teavm/jso/core/JSArray.java @@ -91,6 +91,10 @@ public abstract class JSArray implements JSArrayReader { @NoSideEffects public static native JSArray create(int size); + @JSBody(params = "object", script = "return Array.isArray(object);") + @NoSideEffects + public static native boolean isArray(JSObject object); + @SafeVarargs public static JSArray of(S... items) { JSArray array = create(items.length); diff --git a/jso/apis/src/main/java/org/teavm/jso/core/JSObjects.java b/jso/apis/src/main/java/org/teavm/jso/core/JSObjects.java index 0939c08b7..020fab64b 100644 --- a/jso/apis/src/main/java/org/teavm/jso/core/JSObjects.java +++ b/jso/apis/src/main/java/org/teavm/jso/core/JSObjects.java @@ -27,6 +27,14 @@ public final class JSObjects { @NoSideEffects public static native String[] getOwnPropertyNames(JSObject object); + @JSBody(params = "object", script = "return Object.keys(object);") + @NoSideEffects + public static native String[] keys(JSObject object); + + @JSBody(params = "object", script = "return Object.values(object);") + @NoSideEffects + public static native JSObject[] values(JSObject object); + @JSBody(script = "return {};") @NoSideEffects public static native T create();