Change Case

Wrapper for

change-case
.

⚡️ Prerequisites

npm install --save change-case
npm install --save change-case
sh

Usage

<script>
    import {changeCase} from "@sveu/extend/changeCase"
    
    let value = "Svelte Utility"
    
    console.log(changeCase(value, "snakeCase"))
</script>
<script>
    import {changeCase} from "@sveu/extend/changeCase"
    
    let value = "Svelte Utility"
    
    console.log(changeCase(value, "snakeCase"))
</script>
svelte

Example

svelte_utility

Select Case:

<script lang="ts">
    import {changeCase} from "@sveu/extend/changeCase"

    const cases = [
        "camelCase",
        "capitalCase",
        "constantCase",
        "dotCase",
        "headerCase",
        "noCase",
        "paramCase",
        "pascalCase",
        "pathCase",
        "sentenceCase",
        "snakeCase",
    ]

    let value = "Svelte Utility"

    let selected = "snakeCase"
</script>

<h1 class="font-bold mt-5 text-lg text-center">{changeCase(value, selected)}</h1>

<h2>Select Case:</h2>
<select bind:value="{selected}">
    {#each cases as _case}
        <option value="{_case}">{changeCase(_case, "capitalCase")}</option> 
    {/each}
</select>
<script lang="ts">
    import {changeCase} from "@sveu/extend/changeCase"

    const cases = [
        "camelCase",
        "capitalCase",
        "constantCase",
        "dotCase",
        "headerCase",
        "noCase",
        "paramCase",
        "pascalCase",
        "pathCase",
        "sentenceCase",
        "snakeCase",
    ]

    let value = "Svelte Utility"

    let selected = "snakeCase"
</script>

<h1 class="font-bold mt-5 text-lg text-center">{changeCase(value, selected)}</h1>

<h2>Select Case:</h2>
<select bind:value="{selected}">
    {#each cases as _case}
        <option value="{_case}">{changeCase(_case, "capitalCase")}</option> 
    {/each}
</select>
svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Click fold/expand code

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.