Array.prototype.toObjectByProperty( element=>element.property )

T.J. Crowder tj.crowder at farsightsoftware.com
Wed Aug 9 08:34:11 UTC 2017


On Wed, Aug 9, 2017 at 9:24 AM, Jordan Harband <ljharb at gmail.com> wrote:
>
> I think you're misunderstanding; the function would of course take
> an iterable. However, an iterable of what?
>
> If it's an iterable of objects, then what's the key and what's the
> value? What if it's an iterable of strings?

I can't speak for Naveen, he's gone off in his own direction (or rather, I
have, as it was originally his thread).

But for my part, as I [describe here][1], the common case *I* want to
address is that the value *is* the entry. No round-trip through `[key,
value]` pairs is required for the common use case of creating a map/object
to provide lookup by key. I certainly see why Darien may *also* want to
provide somthing for `[key, value]` pairs, but I see it as separate.

-- T.J. Crowder

[1]:
https://esdiscuss.org/topic/array-prototype-toobjectbyproperty-element-element-property#content-2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170809/3c64d6f1/attachment.html>


More information about the es-discuss mailing list