Improvement: pass more params into `validateRow` for improved row validation
bayareacoder opened this issue · comments
B commented
In file import-controller.ts
, function CheckCSVValidation
, change from:
await Promise.all(csvValues.map((v) => validateRow(v)));
to:
await Promise.all(csvValues.map(validateRow));
so user-provided validation function has access to row index to inform user which row is failing validation, and even the full array of records (3rd arg from array.map) to allow cross-record validation in a data set.
Ben Winding commented
Hi @bayareacoder (Nice username btw),
Yeah I think that's probably a good idea, I'll implement now.
Cheers,
Ben