(Map|Set|WeakMap)#set() returns `this` ?

Andrea Giammarchi andrea.giammarchi at gmail.com
Mon Dec 3 13:28:46 PST 2012


I wonder what was the use case that convinced TC39 to return `this` with
these methods.

Accordingly, this will never work:
var query = map.has('queried') ? map.get('queried') :
map.set('queried', $('myquery'));

And it will be something like:
var query = map.has('queried') ? map.get('queried') :
map.set('queried', $('myquery')).get('queried');

which is ugly and I don't really understand where map.set(k0, v0).set(k1,
v1).set(k2, v2) could be useful.

Thanks for clarifications ( a use case would be already good )

br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121203/43a5cc21/attachment.html>


More information about the es-discuss mailing list