diff --git a/src/csv.ts b/src/csv.ts index 918d913..46da5ae 100644 --- a/src/csv.ts +++ b/src/csv.ts @@ -181,10 +181,8 @@ export async function validateCsv( } return new Promise((resolve, reject) => { - Papa.parse(input, { + const config = { header: false, - newline: "\n", - // chunkSize: 64 * 1024, beforeFirstChunk: (chunk) => { return removeBOM(chunk) }, @@ -197,6 +195,12 @@ export async function validateCsv( }, complete: () => handleParseEnd(resolve), error: (error: Error) => reject(error), - }) + }; + + if (options.newline) { + config.newline = options.newline; + } + + Papa.parse(input, config) }) } diff --git a/src/types.ts b/src/types.ts index 16a601e..45e6d5c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -44,6 +44,7 @@ export interface CsvValidatorVersion { export interface CsvValidationOptions { maxErrors?: number + newline?: string onValueCallback?: (value: { [key: string]: string }) => void }