-
Notifications
You must be signed in to change notification settings - Fork 127
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
add mapEntries function #658
Comments
We have |
i think we could add better typing for in particular, the same arguments can be made for |
If the request is to also build the object after the iteration i agree and think it is a good addition to the library, i think the best api for this would be similar to pullObject, and a good name would be transformObject. |
i believe that is the request! i'll move this to good first issue |
thinking about this more... not sure if something like |
Both callbacks should take the key and value (and the object itself). The order could be flipped so that you can write a simpler 1-param function in most cases: transformObject<T>(
data: T,
keyMapper: (key: ..., value: ..., data: T) => K
valueMapper: (value: ..., key: ..., data: T) => V
): ... |
similar to https://radash-docs.vercel.app/docs/object/map-entries
Seems to make sense because just like Object.values and Object.keys, Object.entries does also exist in regular javascript.
The text was updated successfully, but these errors were encountered: