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

transform-values #30

Open
ctford opened this issue Mar 16, 2015 · 2 comments
Open

transform-values #30

ctford opened this issue Mar 16, 2015 · 2 comments

Comments

@ctford
Copy link

ctford commented Mar 16, 2015

Should there be a counterpart to transform-keys called transform-values? This would apply t to non-map leaves.

I have a current project where a kebabed value can appear both in key position and value position, so I need to transform it consistently.

I'm happy to submit a pull-request if this is something CSK is interested in.

@qerub
Copy link
Collaborator

qerub commented Mar 22, 2015

When you want to transform both keys and values I think it makes sense to use clojure.walk/postwalk directly, like this: (postwalk #(if (keyword? %) (->snake_case_string %) %) {:fooish-bar :fooish-bar}).

I added transform-keys because it's such a common operation and a bit clumsy to do with postwalk directly. I'm not convinced transform-values would see much use, so I'm going to let this issue linger until somebody more chimes in that they miss it.

@ctford
Copy link
Author

ctford commented Mar 22, 2015

That sounds like a sensible approach.

On our project, we have ended up using Traversy's all-values lens instead.

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

No branches or pull requests

2 participants