Created
August 8, 2023 15:24
-
-
Save zacjones93/3bdda6874d3397f1a2c74cdb950e9dad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name: switch-case | |
// Shortcut: shift control C | |
// Description: Change case of text in a sentance. | |
// Cache: true | |
import "@johnlindquist/kit" | |
let { titleCase, sentenceCase, paramCase, camelCase } = await npm("text-case"); | |
let options = { | |
"[T]itle Case": titleCase, | |
"[S]entence case": sentenceCase, | |
"[p]aram-case": paramCase, | |
"[c]amelCase": 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