repomix
Version:
A tool to pack repository contents to single file for AI consumption
36 lines (35 loc) • 1.07 kB
JavaScript
export class BaseParseStrategy {
getCaptureTypes(name, captureTypes) {
const types = new Set();
for (const type of Object.values(captureTypes)) {
if (name.includes(type)) {
types.add(type);
}
}
return types;
}
checkAndAddToProcessed(content, processedChunks) {
const normalized = content.trim();
if (processedChunks.has(normalized)) {
return false;
}
processedChunks.add(normalized);
return true;
}
validateLineExists(lines, startRow) {
return lines[startRow] !== undefined;
}
extractLines(lines, startRow, endRow) {
if (!this.validateLineExists(lines, startRow)) {
return null;
}
const selectedLines = lines.slice(startRow, endRow + 1);
return selectedLines.length > 0 ? selectedLines : null;
}
createNullResult() {
return { content: null };
}
createResult(content, processedSignatures) {
return { content, processedSignatures };
}
}