Skip to main content

Convert strings between different cases while applying styles for terminal.

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
JSR Score
94%
Published
3 months ago (1.0.4)

Convert strings between different cases while applying styles for terminal.

This module uses @luca/cases and chalk.

This module provides a function for converting strings between camel case, snake case, kebab case, title case, pascal case, constant case. You can also use it for splitting a string into pieces based on spaces, dashes, underscores, and camel case.

You can access the api of chalk under chalk namespace.

import chalkedCases, { chalk } from "@furkanly/chalked-cases";

console.log(chalkedCases("hello world", "camel", chalk.default.blue)) // "helloWorld"
console.log(chalkedCases("helloWorld", "snake", chalk.default.blue)) // "hello_world"
console.log(chalkedCases("hello_world", "kebab", chalk.default.blue)) // "hello-world"
console.log(chalkedCases("hello-world", "title", chalk.default.blue)) // "Hello World"
console.log(chalkedCases(["hello", "world"], "pascal", chalk.default.blue)) // "HelloWorld"
console.log(chalkedCases("hello world", "constant", chalk.default.blue)) // "HELLO_WORLD"
console.log(chalkedCases("helloWorld", "split", chalk.default.blue)) // ["hello", "world"]
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @furkankly/chalked-cases

Import symbol

import * as mod from "@furkankly/chalked-cases";

Add Package

npx jsr add @furkankly/chalked-cases

Import symbol

import * as mod from "@furkankly/chalked-cases";

Add Package

yarn dlx jsr add @furkankly/chalked-cases

Import symbol

import * as mod from "@furkankly/chalked-cases";

Add Package

pnpm dlx jsr add @furkankly/chalked-cases

Import symbol

import * as mod from "@furkankly/chalked-cases";

Add Package

bunx jsr add @furkankly/chalked-cases

Import symbol

import * as mod from "@furkankly/chalked-cases";