Recase
Change the casing of strings
Install / Use
/learn @kristiandupont/RecaseREADME
RECASE
Change and detect the casing of a string.
Install
npm i @kristiandupont/recase
Use
const { recase, detectCasing } = require("@kristiandupont/recase");
const initialCase = "snake";
const toCamel = recase(initialCase, "camel");
const toDash = recase(initialCase, "dash");
const s = "some_string_initially_set_with_snake_case";
console.log("Camel cased version:", toCamel(s));
// prints: "Camel cased version: someStringInitiallySetWithSnakeCase"
console.log("Dash cased version:", toDash(s));
// prints: "Dash cased version: some-string-initially-set-with-snake-case"
console.log("Casing detected:", detectCasing(s));
// prints: "Casing detected: snake"
recase
recase(from, to, str);
Takes two casing parameters which can both be one of dash, snake, camel or pascal. Additionally,
from can be mixed or null which will make all word boundaries considered.
The third parameter is the string to recase.
This function is curried which means that if you call it with fewer than three parameters, the return value
will be a new function, with the initial parameters bound. So if you want to have a function that converts
any string to a pascal-cased one, you can create it like so:
const toPascal = recase(null, "pascal");
console.log(toPascal("snake_case"));
// Prints: "SnakeCase"
detectCasing
detectCasing(str);
Takes a string that has been formatted. It will attempt to detect the casing.
Casings
dash:example-stringscreamingDash:EXAMPLE-STRINGsnake:example_stringscreamingSnake:EXAMPLE_STRINGcamel:exampleStringpascal:ExampleStringprose:example stringcapitalProse:Example String
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.6kCommit, push, and open a PR
