Skip to content

Change Case

Wrapper for change-case.

⚡️ Prerequisites

  • Install the change-case package:
$ pnpm add change-case

---> 100%

🎬 Usage

<script>
    import {change_case} from "svelteintegrations/change_case"

    let value = "Svelte Action"
</script>

<h1>{change_case(value, "snakeCase")}</h1>

<input bind:value>

👩‍💻API

Arguments

Name Description Type Required
input The string to convert string Yes
type The type of conversion to perform string Yes

Options

Read the change-case documentation for more information.

Name Description Type Default
splitRegexp used to split into word segments RegExp None
stripRegexp used to remove extraneous characters RegExp /[^A-Z0-9]/gi
delimiter Value used between words string " "
transform Function used to transform each word function None

Returns

The converted string.

🧪 Playground


Last update: 2022-10-23