Skip to content

Commit dd98931

Browse files
Now split on any whitespace
1 parent 4e5afa2 commit dd98931

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

compiled/formatters.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class LinedUpFormatter extends LineFormatter {
2121
if (line.startsWith("#") || line.length === 0) {
2222
return line;
2323
}
24-
const [path, ...owners] = line.split(" ").filter(String);
24+
const [path, ...owners] = line.trim().split(/\s+/).filter(String);
25+
console.log(path);
26+
console.log(maxLength);
2527
const newPath = path.padEnd(maxLength, " ");
2628
const formattedOwners = owners.join(" ");
2729
return `${newPath} ${formattedOwners}`;

compiled/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function formatContents(formatter, fileContents, removeEmptyLines = false) {
5959
return !line.startsWith("#") && line.length > 0;
6060
})
6161
.map((line) => {
62-
const [path, ..._] = line.split(" ");
62+
const [path, ..._] = line.trim().split(/\s+/);
6363
return path.length;
6464
});
6565
const maxLineLength = Math.max(...lineLengths);

src/formatters.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export class LinedUpFormatter extends LineFormatter {
2222
return line;
2323
}
2424

25-
const [path, ...owners] = line.split(" ").filter(String);
25+
const [path, ...owners] = line.trim().split(/\s+/).filter(String);
26+
console.log(path);
27+
console.log(maxLength);
2628
const newPath = path.padEnd(maxLength, " ");
2729
const formattedOwners = owners.join(" ");
2830

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function formatContents(
4949
return !line.startsWith("#") && line.length > 0;
5050
})
5151
.map((line) => {
52-
const [path, ..._] = line.split(" ");
52+
const [path, ..._] = line.trim().split(/\s+/);
5353
return path.length;
5454
});
5555
const maxLineLength = Math.max(...lineLengths);

0 commit comments

Comments
 (0)