W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: [webidl] Add a [Maplike] tag?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 27 Jun 2013 15:59:18 -0700
Message-ID: <CAAWBYDDV6sZd91L1-j11RyFKhy=Tj9EiM70DdJDArWcbYNo6gg@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
On Thu, Jun 27, 2013 at 3:19 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 6/27/13 6:13 PM, Tab Atkins Jr. wrote:
>>> How would one copy one Map into another in ES?  Presumably whatever the
>>> idiom is for that is how this should work...
>>
>> Using the constructor:
>>
>> var m2 = new Map(m1);
>
> That's if you're creating the copy yourself.  How would you do it if you're
> copying into a Map someone provided to you?

Oh, there's no built-in method for that yet (like Python's
Dict#update() method), so you'd use the first case I illustrated
(manually iterating through the source map and setting the values into
the destination map).

~TJ
Received on Thursday, 27 June 2013 23:00:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC