I would not be interested in adding any more mutating methods to
Array.prototype, ever. I'd suggest using `.filter` for this.

On Fri, Feb 7, 2020 at 5:29 AM manuelbarzi <[email protected]> wrote:

> many things that already provide array could be polyfilled, and probably
> many were polyfills before. it's not about to discuss that, but the chance
> to integrate it in array as a useful feature if most agree it could be so.
>
> On Fri, Feb 7, 2020 at 3:34 PM Augusto Moura <[email protected]>
> wrote:
>
>> To me this is more a use case for using Set instead of arrays, the
>> support is already great and it can be polyfilled. Set is the right data
>> structure to verify if some element is or is not in a collection
>>
>> Em sex., 7 de fev. de 2020 às 08:49, manuelbarzi <[email protected]>
>> escreveu:
>>
>>> just a proposal to provide this functionality into array, allowing to
>>> add / remove items in a toggling mechanism shortcut, avoiding the need to
>>> do traversing to locate the indexes and remove them next (i.e. by means of
>>> a polyfill or any other approach).
>>>
>>> ```js
>>> [1, 2, 3, 2, 1].toggle(1) // mutates the original array removing 1,
>>> resulting in [2, 3, 2]
>>> ```
>>> _______________________________________________
>>> es-discuss mailing list
>>> [email protected]
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>
>>
>> --
>> Atenciosamente,
>>
>> Augusto Borges de Moura
>>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to