Skip to content

Commit 6fd0d0a

Browse files
committed
bump: release
1 parent b6d28a1 commit 6fd0d0a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

dist/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,19 @@ const debugRegexMatching = (regexes, str) => {
149149
const paddingRight = Math.min(matchesUntil + 10, copyStr.length);
150150
const rightDots = paddingRight !== copyStr.length ? '…' : '';
151151
const leftDots = paddingLeft !== 0 ? '…' : '';
152+
const errorArrow = `${' '.repeat(leftDots.length)}${" ".repeat(matchesUntil - paddingLeft)}^${"~".repeat(paddingRight - matchesUntil)}`;
153+
const context = `${leftDots}${copyStr.slice(paddingLeft, paddingRight).replaceAll('\n', '␤')}${rightDots}`;
152154
if (str.length > 0 && regexes.length === 0) {
153155
return `Trailing characters: "${str}"
154156
--------------------------------
155-
Context: "${leftDots}${copyStr.slice(paddingLeft, Math.min(copyStr.length, matchesUntil + 10)).replaceAll('\n', '␤')}${rightDots}"
156-
${' '.repeat(leftDots.length)}${" ".repeat(matchesUntil - paddingLeft)}^`;
157+
Context: "${context}"
158+
${errorArrow}`;
157159
}
158160
else {
159-
return `The regex stopped matching at index: ${matchesUntil}.
161+
return `The regex stopped matching at index: ${matchesUntil}
160162
Expected: ${rgx}
161-
Context: "${leftDots}${copyStr.slice(paddingLeft, paddingRight).replaceAll('\n', '␤')}${rightDots}"
162-
${' '.repeat(leftDots.length)}${" ".repeat(matchesUntil - paddingLeft)}^${"~".repeat(paddingRight - matchesUntil)}`;
163+
Context: "${context}"
164+
${errorArrow}`;
163165
}
164166
}
165167
};

0 commit comments

Comments
 (0)