Skip to content

Commit

Permalink
Merge pull request #3 from arnim279/main
Browse files Browse the repository at this point in the history
Add line folding
  • Loading branch information
PeronGH authored Dec 28, 2022
2 parents a93f095 + 3068644 commit 616e424
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions stringify.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
export type ContentLine = [string, string];

function foldLine(line: string) {
return line.match(/(.{1,75})/g)!.join('\r\n ');
}

function stringifyLine(line: ContentLine) {
// TODO: Handle lines longer than 75 bytes
return `${line[0]}:${line[1]}`;
return foldLine(`${line[0]}:${line[1]}`);
}

export function stringifyLines(lines: ContentLine[]) {
Expand Down

0 comments on commit 616e424

Please sign in to comment.