Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ export function split<T>(
csv: string,
transform: (value: string) => T,
horizontalSeparator = "\t",
verticalSeparator: string | RegExp = /\r\n|\n|\r/
verticalSeparator = /\r\n|\n|\r/

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not remove the ability to accept a string here

): Matrix<T> {
return csv
.replace(new RegExp('(' + verticalSeparator.source + ')$'), '') // delete trailing new line character

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please support getting a string here

.split(verticalSeparator)
.map((row) => row.split(horizontalSeparator).map(transform));
}
Expand Down