Skip to main content
Home

@luca/cases@1.0.0
Built and signed on GitHub Actions

A collection of functions for converting strings between different cases.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a year ago (1.0.0)

A collection of functions for converting strings between different cases.

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

All functions can be used with either a single string or an array of strings. The single string will be split into pieces using the splitPieces function.

import * as cases from "@luca/cases";

cases.splitPieces("helloWorld") // ["hello", "world"]
cases.camelCase("hello world") // "helloWorld"
cases.snakeCase("helloWorld") // "hello_world"
cases.kebabCase("hello_world") // "hello-world"
cases.titleCase("hello-world") // "Hello World"
cases.pascalCase(["hello", "world"]) // "HelloWorld"
cases.constantCase("hello world") // "HELLO_WORLD"
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@luca/cases

Import symbol

import * as cases from "@luca/cases";
or

Import directly with a jsr specifier

import * as cases from "jsr:@luca/cases";

Add Package

pnpm i jsr:@luca/cases
or (using pnpm 10.8 or older)
pnpm dlx jsr add @luca/cases

Import symbol

import * as cases from "@luca/cases";

Add Package

yarn add jsr:@luca/cases
or (using Yarn 4.8 or older)
yarn dlx jsr add @luca/cases

Import symbol

import * as cases from "@luca/cases";

Add Package

npx jsr add @luca/cases

Import symbol

import * as cases from "@luca/cases";

Add Package

bunx jsr add @luca/cases

Import symbol

import * as cases from "@luca/cases";