On Jun 27, 2013, at 4:47 PM, Tab Atkins Jr. wrote:

> Has it been discussed yet to add an .update() method to Map and Set, a
> la Python, which take an iterable (yielding [key, value] for Map, and
> just value for Set) and add the iterable's entries to the Map/Set?
> 
> It desugars easily:
> 
> Map.prototype.update = function(iter) {
>  Map(iter).forEach((v,k)=>this.set(k,v));
> };
> Set.prototype.update = function(iter) {
>  Set(iter).forEach(v=>this.add(v));
> };
> 
> I've used this kind of dict/set addition in Python plenty, and added
> the method to my Map polyfill that I use for some personal projects.
> 
> Thoughts?
> 

for (let [k,v] of iter) myMap.set(k,v)




_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to