New Set.prototype methods

Tab Atkins Jr. jackalmage at gmail.com
Tue May 31 23:38:19 UTC 2016


On Sun, May 29, 2016 at 6:13 AM, Michał Wadas <michalwadas at gmail.com> wrote:
> I have written proposal for new Set.prototype methods.
>
> https://github.com/Ginden/set-methods
>
> New methods would be:
>
> Set.prototype.filter
> Set.prototype.map
> Set.prototype.some
> Set.prototype.every
> Set.prototype.find
> Set.prototype.union
> Set.prototype.intersect
> Set.isSet
>
>
> TBA:
>
> Set.prototype.difference (or .except)

Yes *please* to all of these.  I've added most of them manually to
Set.prototype on some of my projects.

One additional request in a related vein - Set.prototype.chain - like
.map, but the callback's value is iterated and added to the result
set.  (We need to coordinate this with an identical method on Array;
.chain just seems to be one of the more common names for this
operation in JS-land.)  I use this a *lot* to, for example, expand
items into related terms.

~TJ


More information about the es-discuss mailing list