Skip to content

Instantly share code, notes, and snippets.

@zacjones93
Created April 26, 2022 19:31
Show Gist options
  • Save zacjones93/d9f3de461259cc9305ae4a05e535920a to your computer and use it in GitHub Desktop.
Save zacjones93/d9f3de461259cc9305ae4a05e535920a to your computer and use it in GitHub Desktop.
// Name: switch-case
// Shortcut: shift control C
// Description: Change case of text in a sentance.
import "@johnlindquist/kit"
let { titleCase, sentenceCase, paramCase, camelCase } = await npm("text-case");
let text = await getSelectedText();
let options = {
"Title Case": titleCase,
"Sentence case": sentenceCase,
"param-case": paramCase,
camelCase: camelCase,
};
let option = await arg(
"What case do you want to convert to?",
Object.keys(options)
);
let formattedText = options[option](text);
await setSelectedText(formattedText);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment