How to control property enumeration (for...in) with Proxy objects?
<p>I'm wrapping an object in a <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Proxy" rel="noreferrer">Proxy</a> and then iterate through it. How can I control the keys it iterates through?</p>

<p>The proxy works if I don't override the keys:</p>

<pre><code>var obj = {"hello": "world"}
var proxy = new Proxy(obj, {})
for (var key in proxy){
    console.log(key)
}
// logs "Hello"
</code></pre>

<p>However, nothing is logged if I change the keys in the <code>ownKeys</code> handler.</p>

<pre><code>var obj = {"hello": "world"}
var proxy = new Proxy(obj, {
    ownKeys: function(){
        return ["a", "b"]
    }
})
for (var key in proxy){
    console.log(key)
}
// Logs nothing
</code></pre>

<p>If I return <code>"hello"</code> as part of the <code>ownKeys</code> only <code>"hello"</code> is logged.</p>

<p>Apparently there was an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/enumerate" rel="noreferrer"><code>enumerate</code></a> trap in ES6, but it has been removed from ES7.</p>

<p>Is it still possible to control the <code>for...in</code> loop with a Proxy? Why was <code>enumerate</code> removed from the spec?</p>