feat(support): onlyKeys and exceptKeys methods for manipulatesarray#2094
feat(support): onlyKeys and exceptKeys methods for manipulatesarray#2094iamdadmin wants to merge 3 commits intotempestphp:3.xfrom
Conversation
innocenzi
left a comment
There was a problem hiding this comment.
I like the methods, but not the names; I don't think generic method names are helpful and I'd like to see more specific ones.
These are essentially "filter" methods, so maybe with should be an update to the existing filter where it accepts an array, and without should be a new reject method?
Well, given that it’s using diffKeys and intersectKeys under the hood, how about Filter I’m guessing already exists and will take a closure. Reject is fine but I think except or without fits it better? Edit: yep, filter takes a closure, and the issue with having it accept either a closure or Edit 2: given the intent behind your suggestion and the possibly ambiguity of using with or without at all (especially as with is sometimes a reserved operator in programming languages), I refactored to |
|
Y'all are going to hate me, but I'd love to be able to pass |
I’d say that’s what the |
Agree. Naming is hard 😅 I think there should be proper symmetry:
tbh my preference is |
Suggested from #2092 - introduces convenience methods
->onlyKeysand->exceptKeysfor ManipulatesArray, and tests.Usage examples from the test: