Furthermore, if you use entries, this allows `[key, value]` entries with object keys to be transformed into objects (which is not allowed by `Object.fromEntries`):
``` const cache = entries.toObject(entry=>entry[0].type, entry=>entry[1]); ``` On Tue, 8 Aug 2017 at 15:52 Naveen Chawla <naveen.c...@gmail.com> wrote: > 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.crow...@farsightsoftware.com> > wrote: > >> On Tue, Aug 8, 2017 at 10:01 AM, Naveen Chawla <naveen.c...@gmail.com> >> 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 >> >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss