CaseStyle behaviour (case_style v0.4.0)
Library from converting to different CaseSyle
s
Currently implemented:
Link to this section Summary
Functions
Converts from CaseStyle.CamelCase
to CaseStyle.KebabCase
same as camel_to_kebab
but return a string on success and raises on error on failure
Converts from CaseStyle.CamelCase
to CaseStyle.PascalCase
same as camel_to_pascal
but return a string on success and raises on error on failure
Converts from CaseStyle.CamelCase
to CaseStyle.SnakeCase
same as camel_to_snake
but return a string on success and raises on error on failure
parse given input with the given module
Converts from CaseStyle.KebabCase
to CaseStyle.CamelCase
same as kebab_to_camel
but return a string on success and raises on error on failure
Converts from CaseStyle.KebabCase
to CaseStyle.PascalCase
same as kebab_to_pascal
but return a string on success and raises on error on failure
Converts from CaseStyle.KebabCase
to CaseStyle.SnakeCase
same as kebab_to_snake
but return a string on success and raises on error on failure
Converts from CaseStyle.PascalCase
to CaseStyle.CamelCase
same as pascal_to_camel
but return a string on success and raises on error on failure
Converts from CaseStyle.PascalCase
to CaseStyle.KebabCase
same as pascal_to_kebab
but return a string on success and raises on error on failure
Converts from CaseStyle.PascalCase
to CaseStyle.SnakeCase
same as pascal_to_snake
but return a string on success and raises on error on failure
Converts from CaseStyle.SnakeCase
to CaseStyle.CamelCase
same as snake_to_camel
but return a string on success and raises on error on failure
Converts from CaseStyle.SnakeCase
to CaseStyle.KebabCase
same as snake_to_kebab
but return a string on success and raises on error on failure
Converts from CaseStyle.SnakeCase
to CaseStyle.PascalCase
same as snake_to_pascal
but return a string on success and raises on error on failure
dump given input with the given module
Link to this section Types
nimble_parsec_error()
Specs
parser_ouput()
Specs
parser_ouput() :: {:ok, list(), binary(), map(), {pos_integer(), pos_integer()}, pos_integer()}
Specs
t() :: %CaseStyle{from_type: module(), tokens: CaseStyle.Tokens.t()}
Link to this section Callbacks
might_be?(input)
Specs
parse(input)
Specs
parse(input :: binary()) :: parser_ouput() | nimble_parsec_error()
to_string(t)
Specs
Link to this section Functions
camel_to_kebab(input)
Specs
camel_to_kebab(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.CamelCase
to CaseStyle.KebabCase
camel_to_kebab!(input)
Specs
same as camel_to_kebab
but return a string on success and raises on error on failure
camel_to_pascal(input)
Specs
camel_to_pascal(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.CamelCase
to CaseStyle.PascalCase
camel_to_pascal!(input)
Specs
same as camel_to_pascal
but return a string on success and raises on error on failure
camel_to_snake(input)
Specs
camel_to_snake(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.CamelCase
to CaseStyle.SnakeCase
camel_to_snake!(input)
Specs
same as camel_to_snake
but return a string on success and raises on error on failure
from_string(input, module)
Specs
from_string(binary(), module()) :: {:ok, t()} | parser_ouput() | nimble_parsec_error()
parse given input with the given module
iex> CaseStyle.from_string("snake_case", CaseStyle.SnakeCase)
{:ok,
%CaseStyle{
from_type: CaseStyle.SnakeCase,
tokens: [
%CaseStyle.Tokens.Start{},
%CaseStyle.Tokens.FirstLetter{value: 's'},
%CaseStyle.Tokens.Char{value: 'n'},
%CaseStyle.Tokens.Char{value: 'a'},
%CaseStyle.Tokens.Char{value: 'k'},
%CaseStyle.Tokens.Char{value: 'e'},
%CaseStyle.Tokens.Spacing{},
%CaseStyle.Tokens.AfterSpacingChar{value: 'c'},
%CaseStyle.Tokens.Char{value: 'a'},
%CaseStyle.Tokens.Char{value: 's'},
%CaseStyle.Tokens.Char{value: 'e'},
%CaseStyle.Tokens.End{}
]
}
}
kebab_to_camel(input)
Specs
kebab_to_camel(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.KebabCase
to CaseStyle.CamelCase
kebab_to_camel!(input)
Specs
same as kebab_to_camel
but return a string on success and raises on error on failure
kebab_to_pascal(input)
Specs
kebab_to_pascal(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.KebabCase
to CaseStyle.PascalCase
kebab_to_pascal!(input)
Specs
same as kebab_to_pascal
but return a string on success and raises on error on failure
kebab_to_snake(input)
Specs
kebab_to_snake(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.KebabCase
to CaseStyle.SnakeCase
kebab_to_snake!(input)
Specs
same as kebab_to_snake
but return a string on success and raises on error on failure
pascal_to_camel(input)
Specs
pascal_to_camel(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.PascalCase
to CaseStyle.CamelCase
pascal_to_camel!(input)
Specs
same as pascal_to_camel
but return a string on success and raises on error on failure
pascal_to_kebab(input)
Specs
pascal_to_kebab(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.PascalCase
to CaseStyle.KebabCase
pascal_to_kebab!(input)
Specs
same as pascal_to_kebab
but return a string on success and raises on error on failure
pascal_to_snake(input)
Specs
pascal_to_snake(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.PascalCase
to CaseStyle.SnakeCase
pascal_to_snake!(input)
Specs
same as pascal_to_snake
but return a string on success and raises on error on failure
snake_to_camel(input)
Specs
snake_to_camel(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.SnakeCase
to CaseStyle.CamelCase
snake_to_camel!(input)
Specs
same as snake_to_camel
but return a string on success and raises on error on failure
snake_to_kebab(input)
Specs
snake_to_kebab(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.SnakeCase
to CaseStyle.KebabCase
snake_to_kebab!(input)
Specs
same as snake_to_kebab
but return a string on success and raises on error on failure
snake_to_pascal(input)
Specs
snake_to_pascal(binary()) :: {:ok, binary()} | nimble_parsec_error()
Converts from CaseStyle.SnakeCase
to CaseStyle.PascalCase
snake_to_pascal!(input)
Specs
same as snake_to_pascal
but return a string on success and raises on error on failure
to_string(input, module)
Specs
dump given input with the given module
iex> input = %CaseStyle{
...> from_type: CaseStyle.SnakeCase,
...> tokens: [
...> %CaseStyle.Tokens.Start{},
...> %CaseStyle.Tokens.FirstLetter{value: 's'},
...> %CaseStyle.Tokens.Char{value: 'n'},
...> %CaseStyle.Tokens.Char{value: 'a'},
...> %CaseStyle.Tokens.Char{value: 'k'},
...> %CaseStyle.Tokens.Char{value: 'e'},
...> %CaseStyle.Tokens.Spacing{},
...> %CaseStyle.Tokens.AfterSpacingChar{value: 'c'},
...> %CaseStyle.Tokens.Char{value: 'a'},
...> %CaseStyle.Tokens.Char{value: 's'},
...> %CaseStyle.Tokens.Char{value: 'e'},
...> %CaseStyle.Tokens.End{}
...> ]
...> }
iex> CaseStyle.to_string(input, CaseStyle.CamelCase)
"snakeCase"