Skip to content

Commit 616e424

Browse files
authored
Merge pull request #3 from arnim279/main
Add line folding
2 parents a93f095 + 3068644 commit 616e424

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stringify.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
export type ContentLine = [string, string];
22

3+
function foldLine(line: string) {
4+
return line.match(/(.{1,75})/g)!.join('\r\n ');
5+
}
6+
37
function stringifyLine(line: ContentLine) {
4-
// TODO: Handle lines longer than 75 bytes
5-
return `${line[0]}:${line[1]}`;
8+
return foldLine(`${line[0]}:${line[1]}`);
69
}
710

811
export function stringifyLines(lines: ContentLine[]) {

0 commit comments

Comments
 (0)