Skip to content

Commit ef6e4cd

Browse files
committed
fix(bval): Handle trailing whitespace without newlines
1 parent d29aec6 commit ef6e4cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/files/dwi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function parseBvalBvec(contents: string): string[][] {
1010
// BVAL files are a single row of numbers, and may contain
1111
// trailing whitespace
1212
return normalizeEOL(contents)
13-
.split(/\s*\n/) // Split on newlines, ignoring trailing whitespace
13+
.split(/\n/) // Split on newlines
1414
.filter((x) => x.match(/\S/)) // Remove empty lines
15-
.map((row) => row.split(/\s+/))
15+
.map((row) => row.trimEnd().split(/\s+/)) // Split on whitespace, ignoring trailing
1616
}

0 commit comments

Comments
 (0)