Reflect.hasOwn() ?

Tom Van Cutsem at
Sat Jul 26 02:33:08 PDT 2014

2014-07-26 5:43 GMT+02:00 Axel Rauschmayer <axel at>:

> ECMAScript 6 mostly eliminates the need to call methods generically (no
> need to use the array-like `arguments`, `Array.from()`, spread operator,
> etc.).
> The only exception that comes to my mind is `{},
> key)` (which is the only safe way to invoke this method). Would it make
> sense to provide that as a tool function, e.g. as `Reflect.hasOwn()`?

Reflect.hasOwn was actually included in the Reflect API initially, as the
dual to the Proxy "hasOwn" trap. When we decided to remove the trap, we
also threw out Reflect.hasOwn (in keeping with the symmetry between these
Reflect.* utilities and the Proxy traps).

The rationale to remove Reflect.hasOwn was that it could easily be
simulated via (Reflect.getOwnPropertyDescriptor(obj,name) !== undefined).
While this conses a throw-away property descriptor object, the overhead was
deemed insignificant.

Overall, I'm leaning towards keeping the built-in Reflect API minimal.
There's room for many more utility methods (Reflect.getPropertyDescriptors
comes to mind) which can all be expressed as a library.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list