View Source Absinthe.Utils (absinthe v1.7.0)

Link to this section Summary

Functions

Camelize a word, respecting underscore prefixes.

Link to this section Functions

Link to this function

camelize(word, opts \\ [])

View Source

Specs

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"