Is there an API available where I can access an index property on an object that is not an array?
The context is we maintain a serde deserializer for RQuickJS values and we need to be able to deserialize a proxy of an array with a custom getter on the proxy.
The code looks like this:
var arrayProxy = new Proxy([], {
get: function(_target, key) {
if (key === 'length') return 2;
return Number(key);
},
});
This is part of the 262 test suite for JSON.stringify and for this particular test case, it should stringify arrayProxy as "[0, 1]".
Object does not appear to have a method that invokes JS_GetPropertyUint32 which is what Array uses for Array::get. When trying to represent arrayProxy as an Array, Value::is_array returns false and Value::as_array returns none so I can't convert arrayProxy into Array. With 0.6.1 (before the switch to quickjs-ng), is_array returned true and as_array returned an Array inside a Some.
Is there an API available where I can access an index property on an object that is not an array?
The context is we maintain a serde deserializer for RQuickJS values and we need to be able to deserialize a proxy of an array with a custom getter on the proxy.
The code looks like this:
This is part of the 262 test suite for
JSON.stringifyand for this particular test case, it should stringifyarrayProxyas"[0, 1]".Objectdoes not appear to have a method that invokesJS_GetPropertyUint32which is whatArrayuses forArray::get. When trying to representarrayProxyas anArray,Value::is_arrayreturns false andValue::as_arrayreturns none so I can't convertarrayProxyintoArray. With 0.6.1 (before the switch to quickjs-ng),is_arrayreturned true andas_arrayreturned anArrayinside aSome.