1.2.0 • Published 1 year ago

case-to-case v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

npm.io

Installation (Try it on StackBlitz)

npm i case-to-case

Using

import { CaseToCase } from 'case-to-case'

const string = new CaseToCase()
const stringInAnyCase = 'helloWorld'

// Bring a string to a specific case
string.toCamelCase(stringInAnyCase) // ➡️ helloWorld
string.toLowerCase(stringInAnyCase) // ➡️ hello-world
string.toLowerKebabCase(stringInAnyCase) // ➡️ hello-world
string.toPascalCase(stringInAnyCase) // ➡️ HelloWorld
string.toUpperCase(stringInAnyCase) // ➡️ HELLO-WORLD
string.toUpperKebabCase(stringInAnyCase) // ➡️ HELLO-WORLD
string.toUpperSnakeCase(stringInAnyCase) // ➡️ HELLO_WORLD

// Is Case
string.isCamelCase(stringInAnyCase) // ➡️ true
string.isLowerCase(stringInAnyCase) // ➡️ false
string.isLowerKebabCase(stringInAnyCase) // ➡️ false
string.isLowerSnakeCase(stringInAnyCase) // ➡️ false
string.isUpperCase(stringInAnyCase) // ➡️ false
string.isUpperKebabCase(stringInAnyCase) // ➡️ false
string.isUpperSnakeCase(stringInAnyCase) // ➡️ false

// Define Case
string.defineCase(stringInAnyCase) // ➡️ camelCase