View Source Absinthe.Utils (absinthe v1.7.8)

Summary

Functions

Camelize a word, respecting underscore prefixes.

Functions

Link to this function

camelize(word, opts \\ [])

View Source
@spec camelize(binary(), Keyword.t()) :: binary()

Camelize a word, respecting underscore prefixes.

Examples

With an uppercase first letter:

iex> camelize("foo_bar")
"FooBar"
iex> camelize("foo")
"Foo"
iex> camelize("__foo_bar")
"__FooBar"
iex> camelize("__foo")
"__Foo"
iex> camelize("_foo")
"_Foo"

With a lowercase first letter:

iex> camelize("foo_bar", lower: true)
"fooBar"
iex> camelize("foo", lower: true)
"foo"
iex> camelize("__foo_bar", lower: true)
"__fooBar"
iex> camelize("__foo", lower: true)
"__foo"
iex> camelize("_foo", lower: true)
"_foo"