Skip to content

Instantly share code, notes, and snippets.

@zacjones93
Created April 24, 2024 22:25
Show Gist options
  • Save zacjones93/19f31bbc94cb305cd711364ba34dcab9 to your computer and use it in GitHub Desktop.
Save zacjones93/19f31bbc94cb305cd711364ba34dcab9 to your computer and use it in GitHub Desktop.
// Author: Zac Jones
// Keyword: sw
import "@johnlindquist/kit"
import { titleCase, sentenceCase, paramCase, camelCase } from "text-case"
let options = {
"[t]itle": titleCase,
"[s]entence": sentenceCase,
"[p]aram": paramCase,
"[c]amel": camelCase,
}
let option = await arg("What case do you want to convert to?", Object.keys(options))
let text = await getSelectedText()
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