Skip to content

Commit adbde40

Browse files
committed
feat(lib): Force splitTest to be between 0 and row count
1 parent 6cec06a commit adbde40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/loadCsv.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const loadCsv = (filename: string, options: CsvReadOptions) => {
4747

4848
if (splitTest) {
4949
const length =
50-
typeof splitTest === 'number' && splitTest > 0
51-
? splitTest
50+
typeof splitTest === 'number'
51+
? Math.max(0, Math.min(splitTest, features.length - 1))
5252
: Math.floor(features.length / 2);
5353

5454
testFeatures = features.slice(length);

0 commit comments

Comments
 (0)