On Thu, Jan 18, 2018 at 11:25 AM, Peter Jaszkowiak wrote:
> Isn't there a proposal for `Map#setAll`? That would fulfill the other use
> case.
Or, stealing naming from Python, Map#update. (I've asked for this in
the past and would be very happy to see it.)
~TJ
Isn't there a proposal for `Map#setAll`? That would fulfill the other use
case.
On Jan 18, 2018 12:24, "Oriol _" wrote:
> > I believe there's a very simple way to do this today: new Map([...mapA,
> ...mapB, ...mapC]).
>
> But this only works if you want to create a
> I believe there's a very simple way to do this today: new Map([...mapA,
> ...mapB, ...mapC]).
But this only works if you want to create a new map, of course. Can't be used
to assign to an existing map.
- Oriol
___
es-discuss mailing list
On Thu, Jan 18, 2018 at 6:59 PM, Gil Tayar wrote:
>
> I believe there's a very simple way to do this today:
> new Map([...mapA, ...mapB, ...mapC]).
facepalm
Yup: https://jsfiddle.net/m23Lgkr1/
-- T.J. Crowder
___
es-discuss mailing
I believe there's a very simple way to do this today: new Map([...mapA,
...mapB, ...mapC]).
Almost as nice as map.assign :-)
- Gil Tayar
On Thu, Jan 18, 2018 at 8:12 PM T.J. Crowder <
tj.crow...@farsightsoftware.com> wrote:
> On Thu, Jan 18, 2018 at 6:08 PM, Mike Samuel
On Thu, Jan 18, 2018 at 6:08 PM, Mike Samuel wrote:
>
> What if, instead of a variety of assign methods, we respeced
> Object.assign to do this given a Map as the left-value?
I think even if one posits that that would have been a good idea when
`Object.assign` was defined,
On Thu, Jan 18, 2018 at 12:37 PM, T.J. Crowder <
tj.crow...@farsightsoftware.com> wrote:
> On Thu, Jan 18, 2018 at 5:28 PM, 森建 wrote:
> >
> > This code is redundant. I just want to write
> > `mapA.assign(mapB, mapC);`.
>
> FWIW, it would be more in keeping with
On Thu, Jan 18, 2018 at 5:28 PM, 森建 wrote:
>
> This code is redundant. I just want to write
> `mapA.assign(mapB, mapC);`.
FWIW, it would be more in keeping with `Object.assign` if it were on `Map`
rather than `Map.prototype`. E.g., you'd write the code above like this:
Hi there,
I want to add `Map#assign` to TC39 Stage 1.
ECMAScript `Object` has `Object.assign`.
On the other hand `Map` doesn't have assigning method.
For example, we must write JavaScript like the following:
```js
const mapA = new Map([["foo", 1], ["bar", 2]]);
const mapB = new Map([["baz",
9 matches
Mail list logo