Script Kit Logo
Script Kit
by John Lindquist
Vercel OSS Program

Scripts by sum117

Chunkify text into discord friendly chunks with an intuitive UI!

sum117's avatar
sum117
import "@johnlindquist/kit"; /** * Chunkify a text into chunks of a given size. * @param {string} text * @param {number} chunkSize */ function chunkify(text, chunkSize) { const chunks = []; let index = 0; while (index < text.length) { let end = index + chunkSize; while (end > index && text[end] !== "\n") { end--; } if (end === index) { end = index + chunkSize;