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

Preserve leading underscores for camel_case_key #3

Conversation

smdern
Copy link
Contributor

@smdern smdern commented Nov 9, 2016

Elixir's Macro.camelize will ditch any leading underscores and upcase
the first letter.

e.g.

iex(4)> Macro.camelize("_foo")
=> "Foo"

Elixir's Macro.camelize will ditch any leading underscores and upcase
the first letter.

e.g.

iex(4)> Macro.camelize("_foo")
=> "Foo"
@johnnyji johnnyji merged commit a680414 into johnnyji:master Nov 9, 2016
@johnnyji
Copy link
Owner

johnnyji commented Nov 9, 2016

@smdern

Thanks for the discovery and contribution!

@smdern
Copy link
Contributor Author

smdern commented Nov 9, 2016

@smdern

Thanks for the discovery and contribution!

Np. That was fast. I created a plug that transforms incoming requests and the responses if you're interested, I can contribute that as well..

an example usage

plug TransformParams,
  params: &ProperCase.to_snake_case/1,
  response: [
    json: &ProperCase.to_camel_case/1,
    plain_text: &String.upcase/1,
  ]

@smdern smdern deleted the preserve-leading-underscores-for-camelcase branch November 9, 2016 04:10
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.

None yet

2 participants