Array.prototype.toObjectByProperty( element=> )

Naveen Chawla naveen.chwl at
Tue Aug 8 08:39:46 UTC 2017

I'd like to propose an enhancement to my proposal:

const cache = iterable.toObject(item=>item.key, item=>item); //2nd param is
optional, default shown

It offers the same functionality, but in addition a second optional
parameter for the "value" in case you want something other than the array
element as the value. By default, if the second parameter isn't populated,
it should use the array element itself, like the example call redundantly

On Tue, 8 Aug 2017 at 11:57 T.J. Crowder <tj.crowder at>

> On Tue, Aug 8, 2017 at 7:18 AM, Naveen Chawla <naveen.chwl at>
> wrote:
> > It'd be great to know if anyone from TC39 is going to propose these
> > ideas (could I submit a in order to help? If so where?)
> Proposals come from the community (of which TC39 members are a part). What
> you've done so far is a suggestion. For it to proceed, someone has to
> create a proper proposal for it.
> Darien's already created one based on his initial interpretation of your
> idea. I intend to do a separate one later this week when I have time and
> after more reflection/feedback, based on what I've wanted for several years
> -- which is, I think, closer to what you originally suggested. As he said,
> the two may or may not compete; I don't think they do, I think they
> complement one another.
> Then we'll see if a TC39 committee member decides to champion either,
> both, or neither of them (or any other that may also be made).
> -- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list