MCPcopy Create free account
hub / github.com/PromtEngineer/localGPT / improvedCleanup

Function improvedCleanup

test_markdown_streaming.js:49–61  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

47}
48
49function improvedCleanup(text) {
50 text = text.replace(/\n{3,}/g, '\n\n');
51
52 text = text.replace(/[ \t]+$/gm, '');
53
54 text = text.replace(/[ \t]{3,}/g, ' ');
55
56 text = text.replace(/[ \t]*\n[ \t]*\n[ \t]*\n/g, '\n\n');
57
58 text = text.trim();
59
60 return text;
61}
62
63console.log("=== ORIGINAL TEXT ===");
64console.log(JSON.stringify(testMarkdownWithExcessiveNewlines));

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected