s6o / elm-recase / ReCase

Convert a string from a case to any other case.

Generic API


type ReCase
    = ToCamel
    | ToConstant
    | ToDot
    | ToKebab
    | ToPascal
    | ToPath
    | ToSentence
    | ToSnake
    | ToTitle

recase : ReCase -> String -> String

Recase input to specified case.

More Explicitly Typed API


type CamelCase

A camelCase String.

fromCamel : CamelCase -> String

Convert from the specific CamelCase type to the generic String type.

toCamel : String -> CamelCase

Convert String to CamelCase.


type ConstantCase

A CONSTANT_CASE String.

fromConstant : ConstantCase -> String

Convert from the specific ConstantCase type to the generic String type.

toConstant : String -> ConstantCase

Convert String to ConstantCase.


type DotCase

A dot.case String.

fromDot : DotCase -> String

Convert from the specific DotCase type to the generic String type.

toDot : String -> DotCase

Convert String to DotCase.


type KebabCase

A kebab-case String.

fromKebab : KebabCase -> String

Convert from the specific KebabCase type to the generic String type.

toKebab : String -> KebabCase

Convert String to KebabCase.


type PascalCase

A PascalCase aka UpperCase String.

fromPascal : PascalCase -> String

Convert from the specific PascalCase type to the generic String type.

toPascal : String -> PascalCase

Convert String to PacalCase.


type PathCase

A path/case String. Conversions to path/case are case-sensitive, that is input's case is not changed, only the path separator / (slash) is inserted.

fromPath : PathCase -> String

Convert from the specific PathCase type to the generic String type.

toPath : String -> PathCase

Convert String to PathCase.


type SentenceCase

A Sentence case String.

fromSentence : SentenceCase -> String

Convert from the specific SentenceCase type to the generic String type.

toSentence : String -> SentenceCase

Convert String to SentenceCase.


type SnakeCase

A snake_case String.

fromSnake : SnakeCase -> String

Convert from the specific SnakeCase type to the generic String type.

toSnake : String -> SnakeCase

Convert String to SnakeCase.


type TitleCase

A Title Case String.

fromTitle : TitleCase -> String

Convert from the specific TitleCase type to the generic String type.

toTitle : String -> TitleCase

Convert String to TitleCase.