Reflect.hasOwn() ?

Andrea Giammarchi andrea.giammarchi at gmail.com
Sat Jul 26 08:51:04 PDT 2014


why would you drop the specificity of the name?

would a Symbol be a valid second argument ?

and what if one day we'd like to introduce a hasOwnValue instead, as
similar to Array#contains but for generic objects ?

Regards


On Sat, Jul 26, 2014 at 5:52 AM, Kevin Smith <zenparsing at gmail.com> wrote:

>
>> 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.
>>
>>
> Sounds good.
>
> Still, hanging "hasOwnProperty" off of Object.prototype was a mistake and
> a is constant source of irritation.  Perhaps the mistake could be rectified
> by hanging the same functionality directly off of Object?
>
>     if (Object.hasOwn(obj, "foo")) doSomething();
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140726/25f64915/attachment.html>


More information about the es-discuss mailing list