Created
October 14, 2022 15:09
-
-
Save tayiorbeii/54731c73227a7d70f3c94f29bbb842b0 to your computer and use it in GitHub Desktop.
This file contains 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
import "@johnlindquist/kit" | |
// Name: | |
let replaceAll = await npm('just-replace-all') | |
let chunkArray = await npm('chunk') | |
let txtFiles = await drop() | |
for (let f of txtFiles) { | |
let text = await readFile(`${f.path}`, 'utf-8') | |
let outdentedTextLines = text.split('\n') | |
let paragraphsArray = chunkArray(outdentedTextLines, 4) | |
let paragraphs = replaceAll(paragraphsArray.map(x => x.join('. ')).join('\n\n\n'), '..', '. ') | |
await writeFile(`${f.path}`, paragraphs) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment