Skip to content

Instantly share code, notes, and snippets.

@dadamssg
Last active September 9, 2022 14:44
Show Gist options
  • Select an option

  • Save dadamssg/0a5f15c82af49ac8df80466d6bc39fdc to your computer and use it in GitHub Desktop.

Select an option

Save dadamssg/0a5f15c82af49ac8df80466d6bc39fdc to your computer and use it in GitHub Desktop.

Revisions

  1. dadamssg revised this gist Sep 9, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion format-json.ts
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ let text = await getSelectedText()

    let json
    try {
    json = jsonabc.sort(String(text).trim(), false, 0)
    json = jsonabc.sort(String(text).trim(), false, 2)
    } catch (e) {
    notify(e.message)
    exit()
  2. dadamssg revised this gist Sep 9, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions format-json.ts
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    // Name: format-json
    // Shortcut: cmd shift j
    // Author: David Adams
    // Twitter: @dadamssg

    import "@johnlindquist/kit"
    let jsonabc = await npm("jsonabc")
  3. dadamssg created this gist Sep 9, 2022.
    17 changes: 17 additions & 0 deletions format-json.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // Name: format-json
    // Shortcut: cmd shift j

    import "@johnlindquist/kit"
    let jsonabc = await npm("jsonabc")

    let text = await getSelectedText()

    let json
    try {
    json = jsonabc.sort(String(text).trim(), false, 0)
    } catch (e) {
    notify(e.message)
    exit()
    }

    await setSelectedText(json)