Proposal: Map#assign

T.J. Crowder tj.crowder at
Thu Jan 18 17:37:45 UTC 2018

On Thu, Jan 18, 2018 at 5:28 PM, 森建 <moriken at> 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:

Map.assign(mapA, mapB, mapC);

or if creating a new map:

const newMap = Map.assign(new Map, mapA, mapB, mapC);

But then, adding methods to `Map.prototype` isn't as fraught as adding
methods to `Object.prototype`... :-)

-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list