Convert the case of a string
yarn add @dekk-utils/string-case
## with npm
# npm install @dekk-utils/string-case
import { camelToSnake } from "@dekk-utils/string-case/camel/snake";
camelToSnake("fooBar")
// foo_bar
import { from } from "@dekk-utils/string-case/from";
from.camel.to.snake("fooBar")
// foo_bar
import { to } from "@dekk-utils/string-case/to";
to.snake.from.camel("fooBar")
// foo_bar
import { convert } from "@dekk-utils/string-case/convert";
convert.snake.to.camel("fooBar")
// foo_bar
convert.camel.from.snake("fooBar")
// foo_bar
import { is } from "@dekk-utils/string-case/is";
is.camel("fooBar")
// true
is.snake("fooBar")
// false
import { isCamel } from "@dekk-utils/string-case/is/camel";
isCamel("fooBar")
// true
isCamel("foo_bar")
// false
import { isKebab } from "@dekk-utils/string-case/is/kebab";
isKebab("foo-bar")
// true
isKebab("foo_bar")
// false
import { isPascal } from "@dekk-utils/string-case/is/pascal";
isPascal("FooBar")
// true
isPascal("foo_bar")
// false
import { isScreamingKebab } from "@dekk-utils/string-case/is/screaming-kebab";
isScreamingKebab("Foo-Bar")
// true
isScreamingKebab("foo_bar")
// false
import { isScreamingSnake } from "@dekk-utils/string-case/is/screaming-snake";
isScreamingSnake("Foo_Bar")
// true
isScreamingSnake("foo_bar")
// false
import { isSnake } from "@dekk-utils/string-case/is/snake";
isSnake("foo_bar")
// true
isSnake("fooBar")
// false
import { isLower } from "@dekk-utils/string-case/is/lower";
isLower("foobar")
// true
isLower("fooBar")
// false
import { isUpper } from "@dekk-utils/string-case/is/upper";
isUpper("FOOBAR")
// true
isUpper("fooBar")
// false
import { isButton } from "@dekk-utils/string-case/is/button";
isButton("Foo Bar")
// true
isButton("fooBar")
// false
import { isSentence } from "@dekk-utils/string-case/is/sentence";
isSentence("Foo bar")
// true
isSentence("fooBar")
// false
import { getCase } from "@dekk-utils/string-case/get-case";
getCase("fooBar")
// camel
getCase("foo_bar")
// snake
import { toCase } from "@dekk-utils/string-case/to-case";
// As default export
// import toCase from "@dekk-utils/string-case";
toCase("fooBar", "snake")
// foo_bar
toCase("foo_bar", "camel")
// fooBar
import { toCamelCase } from "@dekk-utils/string-case/to-camel-case";
toCamelCase("foo_bar")
// fooBar
import { toKebabCase } from "@dekk-utils/string-case/to-kebab-case";
toKebabCase("foo_bar")
// foo-bar
import { toPascalCase } from "@dekk-utils/string-case/to-pascal-case";
toPascalCase("foo_bar")
// FooBar
import { toScreamingKebabCase } from "@dekk-utils/string-case/to-screaming-kebab-case";
toScreamingKebabCase("foo_bar")
// FOO-BAR
import { toScreamingSnakeCase } from "@dekk-utils/string-case/to-screaming-snake-case";
toScreamingSnakeCase("foo_bar")
// FOO_BAR
import { toSnakeCase } from "@dekk-utils/string-case/to-snake-case";
toSnakeCase("fooBar")
// foo_bar