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

replaceKeys method #213

Merged
merged 5 commits into from
Jun 19, 2024
Merged

replaceKeys method #213

merged 5 commits into from
Jun 19, 2024

Conversation

gustavoguichard
Copy link
Owner

This PR adds a new helper: replaceKeys and helper type: ReplaceKeys to run a replace transformation on the keys of an object.

We could argue that adding this method opens the door for other methods, like replaceAllKeys, or deepReplaceKeys, and so on.

However I haven't ran into a use case for the other ones while I have ran on use cases for replaceKeys.

If any contributor wants to send PR for other methods it'd be nice to know the use case ;)

Copy link
Contributor

@jly36963 jly36963 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it support unions, non-literals, and template strings (if applicable)?

@gustavoguichard
Copy link
Owner Author

Does it support unions, non-literals, and template strings (if applicable)?

I think so because we are just reusing the functions that already do.
That said I'll create a test just in case.

@gustavoguichard
Copy link
Owner Author

@jly36963 done

@gustavoguichard gustavoguichard merged commit 5a29efa into main Jun 19, 2024
5 checks passed
@gustavoguichard gustavoguichard deleted the replace-keys branch June 19, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants