quickjs
quickjs copied to clipboard
Proxy for-in not work
The following code does not work in QuickJS, ownKeys
and getOwnPropertyDescriptor
are called, but the for-in
block is never entered.
let target = {}
let proxy = new Proxy(target, {
ownKeys: function() {
return ["a", "b"];
},
getOwnPropertyDescriptor: function(target, key) {
return { enumerable: true, configurable: true, value: this[key] };
}
});
for(let o in proxy) {
console.log(o);
}
// should print
// a
// b