Convert the text to the specified case

import { convertCase } from '@kitsuyui/string'
convertCase('hello world', 'kebab-case') // => 'hello-world'
convertCase('hello world', 'snake_case') // => 'hello_world'
convertCase('hello world', 'space separated') // => 'hello world'
convertCase('hello world', 'camelCase') // => 'helloWorld'
convertCase('hello world', 'UpperCamelCase') // => 'HelloWorld'
convertCase('hello world', 'lowerCamelCase') // => 'helloWorld'
convertCase('hello world', 'PascalCase') // => 'HelloWorld'
  • Parameters

    • text: string
    • toCase:
          | "kebab-case"
          | "snake_case"
          | "space separated"
          | "camelCase"
          | "UpperCamelCase"
          | "lowerCamelCase"
          | "PascalCase"
          | "lowerPascalCase"
          | "SCREAMING_SNAKE_CASE"
          | "MACRO_CASE"
          | "Train-Case"
          | "dot.separated"
          | "flatcase"
          | "ALL CAPS"

    Returns string