MCPcopy Create free account
hub / github.com/TheJoWo/Clean-Clode / detectAndClean

Function detectAndClean

script.js:541–561  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

539 }
540
541 function detectAndClean(input) {
542 if (!input.trim()) {
543 return '';
544 }
545
546 if (/^\s*\d+\s*[+-]\s/m.test(input)) {
547 return cleanGitDiff(input);
548 }
549
550 if (/[│┃╏╎▌]/.test(input) || /\|/.test(input)) {
551 return cleanClaudeDump(input);
552 }
553
554 const codeScore = (input.match(/[{}();=]/g) || []).length;
555 const lineCount = input.split('\n').length;
556 if (lineCount > 0 && codeScore / lineCount > 0.5) {
557 return input.trim(); // leave code mostly untouched
558 }
559
560 return cleanLLMText(input);
561 }
562
563 cleanBtn.addEventListener('click', performCleanup);
564

Callers 1

performCleanupFunction · 0.85

Calls 3

cleanGitDiffFunction · 0.85
cleanClaudeDumpFunction · 0.85
cleanLLMTextFunction · 0.85

Tested by

no test coverage detected