This example could be fixed by passing `{}` as the proxy target. On Fri, May 10, 2019 at 01:23 Claude Pache <claude.pa...@gmail.com> wrote:
> > > Le 9 mai 2019 à 23:17, Tom Barrasso <t...@barrasso.me> a écrit : > > If this Symbol were seriously considered I believe it would expand the > meaning of the in operator as you’re correct, this is definitely not it’s > current intention. > > > The `in` operator has a well-defined meaning, that *by design* you can’t > ignore even with the fanciest proxy. (And no, there is no hope for > introducing a new mechanism that allows to overcome those limitations, > since they are by design.) > Consider for example the following proxy around a String object: > > ```js > function conflateInAndIncludes(str) { > return new Proxy(Object(str), { > has(target, key) { return str.includes(key) } > }) > } > > var FrankensteinFood = conflateInAndIncludes("food"); > > "foo" in FrankensteinFood // true, yeah! > "bar" in FrankensteinFood // false, yeah! > "length" in FrankensteinFood // TypeError: proxy can't report a > non-configurable own property '"length"' as non-existent > ``` > > > —Claude > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- ----- Isiah Meadows cont...@isiahmeadows.com www.isiahmeadows.com
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss