Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing the assign, getOwnPropertySymbols, getPrototypeOf, and getOwnPropertyDescriptors methods

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were all functions that I was not able to implement for various reasons and therefore left out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine in that case. We can add them once we fix the underlying issues

Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,12 @@ public double[] asDoubleArray() {
@SuppressWarnings("unchecked")
@Override
public <T> T as(Class<T> cls) {
Object facade = extractFacadeClass(cls);
if (cls.isAssignableFrom(this.getClass())) {
return (T) this;
}
T facade = extractFacadeClass(cls);
if (facade != null) {
return (T) facade;
return facade;
}
return super.as(cls);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public int hashCode() {

public static String keyFor(JSSymbol sym) {
JSValue result = keyForRaw(sym);
return result instanceof JSUndefined ? null : result.asString();
return JSValue.isUndefined(result) ? null : result.asString();
}

@JS.Coerce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ public static <R> R checkedCoerce(Object value, Class<R> cls) {
return (R) value;
}

/**
* Checks whether the given JSValue is the JavaScript 'undefined' value.
*
* @param value the JSValue to check
* @return true if the value is an instance of JSUndefined, false otherwise
*/
public static boolean isUndefined(JSValue value) {
return value instanceof JSUndefined;
}

public static JSUndefined undefined() {
return JSUndefined.instance();
}
Expand Down