INNER CODE UNIT · JavaScript
dropped
nadimtuhin/claude-token-optimizer · src/commands/compress.js:31
const dropped = lines.length - maxItems;
changes.push(`Truncated list (kept ${maxItems} of ${lines.length} items)`);
return kept.join('\n') + `\n- # ... ${dropped} more\n`;
},
);
return { result, changes };
}
export function stripMarkup(content) {
const changes = [];
let result = content;
const comments = result.match(/<!--[\s\S]*?-->/g) ?? [];
if (comments.length > 0) {
result = result.replace(/<!--[\s\S]*?-->/g, '');
changes.push(`Removed ${comments.length} HTML comment${comments.length > 1 ? 's' : ''}`);
}