waldron.rick at gmail.com
Sun Jul 27 15:07:21 PDT 2014
On Sunday, July 27, 2014, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Sat, Jul 26, 2014 at 11:36 AM, Kevin Smith <zenparsing at gmail.com
> >> * As far as I can tell, `hasOwnProperty` is mainly used to implement
> >> via objects. `Map` will eliminate this use case.
> > To a certain extent yes, but not completely. Objects-as-maps will still
> > used quite frequently as object literals passed into functions (as an
> > options object, for example).
> In that case, though, you don't want to use `hasOwnProperty`; you want
> to allow property bags to express properties on the proto (for
> example, as getters). So this particular use-case of objects-as-maps
> is irrelevant for the question at hand.
> > I think that there is still a need here. Since we are really interested
> > *keys*, what about this:
> > Object.hasKey(obj, someKey);
> > which would be a more ergonomic and efficient way of saying:
> > Object.keys(obj).some(key => key === someKey)
> This is identical to `obj.key !== undefined`,
As long as "key" is enumerable.
> unless you're allowing
> undefined to be passed explicitly as a valid argument for some reason.
> es-discuss mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss