Skip to content

Instantly share code, notes, and snippets.

@tayiorbeii
Created October 14, 2022 15:14
Show Gist options
  • Save tayiorbeii/facb14873707f9518716cd71d4e45925 to your computer and use it in GitHub Desktop.
Save tayiorbeii/facb14873707f9518716cd71d4e45925 to your computer and use it in GitHub Desktop.
import "@johnlindquist/kit"
// Name: bullets-to-paragraphs
let outdent = await npm('tiny-dedent')
let replaceAll = await npm('just-replace-all')
let chunkArray = await npm('chunk')
let text = await paste()
let outdentedTextLines = replaceAll(text, '\n-', '').split('. ')
let paragraphsArray = chunkArray(outdentedTextLines, 4)
let paragraphs = paragraphsArray.map(x => x.join('. '))
// dev({outdentedTextLines, paragraphs})
await copy(paragraphs.join('\n'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment