Array.prototype.toObjectByProperty( element=> )

Naveen Chawla naveen.chwl at
Tue Aug 8 10:22:13 UTC 2017

Philosophically I agree completely with this principle.

This does not have a bunch of options:

iterable.toObject(keyFromElement[, valueFromElement])

What I proposed has only 1 variant: the fact that `valueFromElement` has a
default if you don't provide it.

Objects as they are are simple per insertion: 1. key, 2. value.

It's not straightforward to do my (latest) proposal without it, in
particular if the object property values you want doesn't contain the key
itself because it's derived from a different piece of data from which it
doesn't exist.

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

> On Tue, Aug 8, 2017 at 10:01 AM, Naveen Chawla <naveen.chwl at>
> wrote:
> >
> > Yeah except in what I'm saying it's optional
> My point is you'd use the right tool for the job at hand, rather than
> having a single tool with a bunch of options making it complex to explain,
> use, and optimize. If you review my earlier suggestion and the
> back-and-forth with Darien, I think you'll see what I mean.
> -- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list