Skip to content
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

Open
silveltman opened this issue Apr 29, 2024 · 4 comments
Open

add mapEntries function #658

silveltman opened this issue Apr 29, 2024 · 4 comments
Labels
feature request New feature or request good first issue Good for newcomers runtime Issues that refer to the runtime behavior

Comments

@silveltman
Copy link

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.

@eranhirsch
Copy link
Collaborator

We have entries() and map(). We tend not to add very simple compositions of other utils if they don't benefit at runtime or can provide better typing than using the composition itself.

@eranhirsch eranhirsch added feature request New feature or request runtime Issues that refer to the runtime behavior labels Apr 29, 2024
@cjquines
Copy link
Collaborator

i think we could add better typing for mapEntries than the composition entries, map, fromEntries

in particular, the same arguments can be made for mapEntries, mapKeys, and mapValues; if we have the latter two, i don't see why not to have mapEntries

@eranhirsch
Copy link
Collaborator

eranhirsch commented Apr 29, 2024

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.
It exists in hack as Dict\pull_with_keys

@cjquines
Copy link
Collaborator

i believe that is the request! i'll move this to good first issue

@cjquines cjquines added the good first issue Good for newcomers label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request good first issue Good for newcomers runtime Issues that refer to the runtime behavior
Projects
None yet
Development

No branches or pull requests

3 participants