Skip to content

Latest commit

 

History

History
274 lines (206 loc) · 4.5 KB

README.md

File metadata and controls

274 lines (206 loc) · 4.5 KB

string-case

Codacy Badge Codacy Badge

Convert the case of a string

Installation

yarn add @dekk-utils/string-case
## with npm
# npm install @dekk-utils/string-case

Modules

caseToCase

import { camelToSnake } from "@dekk-utils/string-case/camel/snake";
camelToSnake("fooBar")
// foo_bar

from

import { from } from "@dekk-utils/string-case/from";
from.camel.to.snake("fooBar")
// foo_bar

to

import { to } from "@dekk-utils/string-case/to";
to.snake.from.camel("fooBar")
// foo_bar

convert

import { convert } from "@dekk-utils/string-case/convert";
convert.snake.to.camel("fooBar")
// foo_bar
convert.camel.from.snake("fooBar")
// foo_bar

is

import { is } from "@dekk-utils/string-case/is";
is.camel("fooBar")
// true
is.snake("fooBar")
// false

isCamel

import { isCamel } from "@dekk-utils/string-case/is/camel";
isCamel("fooBar")
// true
isCamel("foo_bar")
// false

isKebab

import { isKebab } from "@dekk-utils/string-case/is/kebab";
isKebab("foo-bar")
// true
isKebab("foo_bar")
// false

isPascal

import { isPascal } from "@dekk-utils/string-case/is/pascal";
isPascal("FooBar")
// true
isPascal("foo_bar")
// false

isScreamingKebab

import { isScreamingKebab } from "@dekk-utils/string-case/is/screaming-kebab";

isScreamingKebab("Foo-Bar")
// true
isScreamingKebab("foo_bar")
// false

isScreamingSnake

import { isScreamingSnake } from "@dekk-utils/string-case/is/screaming-snake";

isScreamingSnake("Foo_Bar")
// true
isScreamingSnake("foo_bar")
// false

isSnake

import { isSnake } from "@dekk-utils/string-case/is/snake";

isSnake("foo_bar")
// true
isSnake("fooBar")
// false

isLower

import { isLower } from "@dekk-utils/string-case/is/lower";

isLower("foobar")
// true
isLower("fooBar")
// false

isUpper

import { isUpper } from "@dekk-utils/string-case/is/upper";

isUpper("FOOBAR")
// true
isUpper("fooBar")
// false

isButton

import { isButton } from "@dekk-utils/string-case/is/button";

isButton("Foo Bar")
// true
isButton("fooBar")
// false

isSentence

import { isSentence } from "@dekk-utils/string-case/is/sentence";

isSentence("Foo bar")
// true
isSentence("fooBar")
// false

getCase

import { getCase } from "@dekk-utils/string-case/get-case";
getCase("fooBar")
// camel
getCase("foo_bar")
// snake

toCase

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

toCamelCase

import { toCamelCase } from "@dekk-utils/string-case/to-camel-case";

toCamelCase("foo_bar")
// fooBar

toKebabCase

import { toKebabCase } from "@dekk-utils/string-case/to-kebab-case";

toKebabCase("foo_bar")
// foo-bar

toPascalCase

import { toPascalCase } from "@dekk-utils/string-case/to-pascal-case";

toPascalCase("foo_bar")
// FooBar

toScreamingKebabCase

import { toScreamingKebabCase } from "@dekk-utils/string-case/to-screaming-kebab-case";

toScreamingKebabCase("foo_bar")
// FOO-BAR

toScreamingSnakeCase

import { toScreamingSnakeCase } from "@dekk-utils/string-case/to-screaming-snake-case";

toScreamingSnakeCase("foo_bar")
// FOO_BAR

toSnakeCase

import { toSnakeCase } from "@dekk-utils/string-case/to-snake-case";

toSnakeCase("fooBar")
// foo_bar