mobxjs/mobx

array remove by predicate should be implemented

Closed this issue · 4 comments

I use this pattern so often:

myObservableArray.replace(myObservableArray.filter(item => item.bad !== true));

so I think it should be implemented by default.

myObservableArray.removeAll(item => item.bad === true)

Meh, not really. because currently only item match is existing but this is kinda different, since i want to use a predicate. Maybe not only I item exists which I want to remove. I updated my ticket, to describe my request better.

Feel free to submit a PR :) removeAll sounds like a sane name