-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request-Object] PickBy #157
[Feature Request-Object] PickBy #157
Comments
Hey @lveillard 👋 I agree, being able to filter in a more dynamic way would be great! I'm hesitant to follow the path that lodash took. Honestly, the whole const filter = <T>(
obj: T,
fn: (k: keyof T, v: T) => boolean
): Partial<T> |
Why not! I tend to call these oFilter, oMap... in order to make them obviously different to filter(), map()... The o for "object" as they are object to object functions. I always imagined these working natively like this:
|
Funny, I call them filtero and mapo 🍻 This is a pretty simple one, would you be interested in implementing it? |
😂 And right now i'm figthing against some deadlines but happy to collaborate after that! |
I'm struggling a bit with the Filter function's types but i added a find function. For the filter i'm here:
but i'm not there yet |
What about this one? |
I think the return type you want is Question, you're saying filter here but your PR says find. Did I miss something there? |
Yay, they are two different functions but im not sure about the naming. Find gets only property and returns directly its value |
For the record, radash |
Any progress on this? |
Hello @lveillard, @yubaoquan, and @prigaux. Over at the Radashi fork, we've implemented |
Thanks! What would be the difference vs using shake()? |
It's the opposite of “ Some prefer this: pick(obj, (value) => isWhatImLookingFor(value)) …over this: shake(obj, (value) => !isWhatImLookingFor(value)) I guess it's mostly an opinion on what's more readable. Also, a pick(obj, (value, key) => key !== 'foo' && value > 1) |
@lveillard Sorry, I missed this part in my previous reply. Would you mind opening a discussion here to get your thoughts out on this? |
Hello!
I was wondering if somebody is up to build this one
is similar to array.find() but for objects
Smething like this:
The text was updated successfully, but these errors were encountered: