Proposal: Map#assign

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


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

```js
Map.assign(mapA, mapB, mapC);
```

or if creating a new map:

```js
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: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180118/d02d7839/attachment.html>


More information about the es-discuss mailing list