We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae78a7d commit 3b5cd90Copy full SHA for 3b5cd90
lib/jsonapi/utils/string.ex
@@ -115,6 +115,9 @@ defmodule JSONAPI.Utils.String do
115
iex> camelize("alreadyCamelized_id")
116
"alreadyCamelizedId"
117
118
+ iex> camelize("PascalLambda_id")
119
+ "pascalLambdaId"
120
+
121
"""
122
@spec camelize(atom) :: String.t()
123
def camelize(value) when is_atom(value) do
@@ -138,7 +141,9 @@ defmodule JSONAPI.Utils.String do
138
141
139
142
# If there are multiple words, perform the camelizing
140
143
[h | t] ->
- Enum.join([h | camelize_list(t)])
144
+ {first_character, rest_word} = String.split_at(h, 1)
145
+ first_word = String.downcase(first_character) <> rest_word
146
+ Enum.join([first_word | camelize_list(t)])
147
end
148
149
0 commit comments