mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: /owned-tanks links to tankopedia and chunks better
This commit is contained in:
1 parent
5b5e204cce
commit
d9f6acea2d
2 files changed
+29
-13
No files matched your search
@@ -0,0 +1,17 @@
|
||||
export function chunkLines(lines: string[], joiner = '\n', maxSize = 2000) {
|
||||
const chunks = [''];
|
||||
|
||||
lines.map((line) => {
|
||||
if (chunks.at(-1)!.length + line.length > maxSize) {
|
||||
chunks.push('');
|
||||
}
|
||||
|
||||
if (chunks.at(-1)!.length === 0) {
|
||||
chunks[chunks.length - 1] += line;
|
||||
} else {
|
||||
chunks[chunks.length - 1] += joiner + line;
|
||||
}
|
||||
});
|
||||
|
||||
return chunks;
|
||||
}
|
||||
Reference in new issue
Block a user