You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case the CSV file needs to be used for something after validation, it would be good to have a way of getting all the validated rows separately from the error rows. That way, the code can continue running for the validated rows, while the non-validated rows can be handled separately without having to stop the entire code.
For each header, there needs to be an option that will say if an error in validation for that header will cause the row to be removed from the validated rows.
For example:
{
name: 'Email',
inputName: 'email',
removeIfNotValid: true,
unique: true,
uniqueError: function (headerName) {
return ${headerName} is not unique
},
validate: function(email) {
return isEmailValid(email)
},
validateError: function (headerName, rowNumber, columnNumber) {
return ${headerName} is not valid in the ${rowNumber} row / ${columnNumber} column
}
}
The removeIfNotValid will indicate whether or not a row should be removed from the Valid object.
The "csvData" object will then contain 3 objects instead of 2: inValidMessages, data and validData, with the last containing ONLY the rows that have been validated correctly.
Another option is to have yet another object: invalidData, which will contain the original rows that have not validated correctly.
The text was updated successfully, but these errors were encountered:
In case the CSV file needs to be used for something after validation, it would be good to have a way of getting all the validated rows separately from the error rows. That way, the code can continue running for the validated rows, while the non-validated rows can be handled separately without having to stop the entire code.
For each header, there needs to be an option that will say if an error in validation for that header will cause the row to be removed from the validated rows.
For example:
{
name: 'Email',
inputName: 'email',
removeIfNotValid: true,
unique: true,
uniqueError: function (headerName) {
return
${headerName} is not unique
},
validate: function(email) {
return isEmailValid(email)
},
validateError: function (headerName, rowNumber, columnNumber) {
return
${headerName} is not valid in the ${rowNumber} row / ${columnNumber} column
}
}
The removeIfNotValid will indicate whether or not a row should be removed from the Valid object.
The "csvData" object will then contain 3 objects instead of 2: inValidMessages, data and validData, with the last containing ONLY the rows that have been validated correctly.
Another option is to have yet another object: invalidData, which will contain the original rows that have not validated correctly.
The text was updated successfully, but these errors were encountered: