Do you prefer people to use `filterNot` or `filter...
# codereview
e
Do you prefer people to use
filterNot
or
filter { not condition }
. I missed
Not
in the
filterNot
recently in review. It is probably matter of time when I will be fine.
t
I prefer
filterNot
, I like my condition to be positive, I find them easier to understand
👍 3
m
I prefer
filter
100% of the time, because then I can only focus on the condition, and I don't need to "remember" if it's filter or filterNot
☝️ 5
p
It depends on the intention
So if we had rps (rock paper scissors) I do: Rocks = rps.filter it==rock NotRocks = RPS.filterNot it==rock
👍 1
But generally positive things read better
So filter it.isvalid is generally easier to understand than filterNot it.isInvalid