Map methods

Michał Wadas michalwadas at gmail.com
Sat Jan 20 00:38:23 UTC 2018


Hi.

With Set methods being discussed on next TC39 I would like to write second
proposal - Map methods.

Currently I thought about:

Map.prototype.filter(cb, thisArg)
Map.prototype.mapValues(cb, thisArg)
Map.prototype.mapKeys(cb, thisArg)
Map.prototype.merge(iterable: Iterable.<Tuple.<*, *>>)

Map.groupBy(iterable, keyDerivativeFunc) - analogus to lodash.groupBy
<https://lodash.com/docs/4.17.4#groupBy>, but returning Map Instance.
Map.keyBy(iterable, keyDerivativeFunc) - analogous to lodash.keyBy, but
returning Map instance.

I spend few minutes on writing code for simple polyfill -
https://github.com/Ginden/map-methods/blob/master/polyfill.js and I'm
gathering opinions what would be expected final shape of Map API.

Michał Wadas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180120/55c39343/attachment.html>


More information about the es-discuss mailing list