Last active
September 9, 2022 14:44
-
-
Save dadamssg/0a5f15c82af49ac8df80466d6bc39fdc 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: format-json | |
// Shortcut: cmd shift j | |
// Author: David Adams | |
// Twitter: @dadamssg | |
import "@johnlindquist/kit" | |
let jsonabc = await npm("jsonabc") | |
let text = await getSelectedText() | |
let json | |
try { | |
json = jsonabc.sort(String(text).trim(), false, 2) | |
} catch (e) { | |
notify(e.message) | |
exit() | |
} | |
await setSelectedText(json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment