We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d33e11c commit a57dce7Copy full SHA for a57dce7
src/bin/readme-assertions.js
@@ -16,11 +16,11 @@ const trimCode = (code) => {
16
const lastIndentSize = lastLineIndentation ? lastLineIndentation[0].length : 0;
17
18
lines = lines.map((line, index) => {
19
- if (index === 0) {
20
- return line.slice(Math.min(firstIndentSize, lastIndentSize));
21
- }
+ const lineIndentSize = firstIndentSize !== 0 || index === 0 ?
+ Math.min(firstIndentSize, lastIndentSize) :
+ lastIndentSize;
22
23
- return line.slice(lastIndentSize);
+ return line.slice(lineIndentSize);
24
});
25
26
return lines.join('\n');
0 commit comments