Array.prototype.toObjectByProperty( element=>element.property )
Michał Wadas
michalwadas at gmail.com
Tue Aug 15 22:09:50 UTC 2017
As far as I remember Maps have the same performance as objects in case of
dynamic property access for small collections and better for big ones (I
have value of 255 in my mind, but I can't test it now). And objects do
maintain insert order, at least in some cases.
On Tue, 15 Aug 2017 at 23:45, Naveen Chawla <naveen.chwl at gmail.com> wrote:
> OK, I have written up a proposal that I really hope satisfies every single
> requirement outlined in this discussion. If not, please recommend
> amendments. It is here:
> https://github.com/TheNavigateur/arrays-and-other-iterables-to-objects-and-maps .
> Do give comments here either way
>
> On Mon, 14 Aug 2017 at 12:14 T.J. Crowder <tj.crowder at farsightsoftware.com>
> wrote:
>
>> On Mon, Aug 14, 2017 at 7:33 AM, Naveen Chawla <naveen.chwl at gmail.com>
>> wrote:
>> > I've never been concerned about needing to allow "toString" etc.
>> > as valid cache keys, so it's never been an issue for me so far.
>> > However, if I did in future, I would honestly look to delete them
>> > from the Object.prototype in my application since I never use
>> > anything in there, as long as I knew it was safe to do so.
>>
>> I very much doubt it's safe; if you're using **any** library, I expect it
>> would blow up fairly quickly.
>>
>> It's also not remotely necessary. Just create an object with no
>> prototype: `Object.create(null)`.
>>
>> -- T.J. Crowder
>>
>> _______________________________________________
> 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/20170815/3416085d/attachment.html>
More information about the es-discuss
mailing list