fix(gateguard): match heredoc tab-strip order

This commit is contained in:
haelyra
2026-08-29 14:55:14 -04:00
parent fab534f924
commit 224da03d01
2 changed files with 10 additions and 9 deletions
+4 -3
View File
@@ -134,11 +134,12 @@ function hasLineContinuation(line) {
function normalizeUnquotedHeredocLines(lines, stripTabs = false) {
const logical = lines
.map((line, index) => {
if (index === lines.length - 1) return line;
return hasLineContinuation(line) ? line.slice(0, -1) : `${line}\n`;
const normalized = stripTabs ? line.replace(/^\t+/, '') : line;
if (index === lines.length - 1) return normalized;
return hasLineContinuation(normalized) ? normalized.slice(0, -1) : `${normalized}\n`;
})
.join('');
return stripTabs ? logical.replace(/^\t+/, '') : logical;
return logical;
}
/** @returns {{ text: string, nextIndex: number }} */