Closed wild-lotus closed 6 years ago
Hey @CarlosGines,
Did you find yourself needing a function like this? What were you trying to do? Those questions are my first thoughts when looking at PRs for list-extra.
Hi @Chadtech,
Sure! Given a list of items, I want to update one of them with the data received from an API request. So I want to find it by id
and directly replace it or remove it.
Are you sure you need to be using a list at all? If you have unique id
s, maybe you need a Dict
?
Also, list-extra
already contains replaceIf
. Do you think that would help in your case? We dont have a removeIf
, but I suppose that would be the same as List.filter
You are might, you can just use a Dict
for these cases. Ok, thank you!
Hi folks, I was just missing a function to remove the first element that satisfies a condition. The same goes for replacing. Their types would be:
It could be useful to remove by
id
(or any other field) from a list of records. What do you think? I would be happy to attempt a PR if you find it suitable.