From 5aa2252afa585c749bc7c0c5bbcee70826d33645 Mon Sep 17 00:00:00 2001 From: shystruk Date: Wed, 8 Dec 2021 15:55:16 -0800 Subject: [PATCH 1/2] fix error messages spacing --- src/csv-file-validator.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/csv-file-validator.js b/src/csv-file-validator.js index 3099ffa..b764286 100644 --- a/src/csv-file-validator.js +++ b/src/csv-file-validator.js @@ -78,11 +78,9 @@ if (valueConfig.name !== columnValue) { file.inValidMessages.push( _isFunction(valueConfig.headerError) - ? valueConfig.headerError( - columnValue, valueConfig.name, rowIndex + 1, columnIndex + 1 - ) - : `Header name ${columnValue} is not correct or missing in the ${rowIndex + 1} row/ - ${columnIndex + 1} column. The Header name should be ${valueConfig.name}` + ? valueConfig.headerError(columnValue, valueConfig.name, rowIndex + 1, columnIndex + 1) + : 'Header name ' + columnValue + ' is not correct or missing in the ' + (rowIndex + 1) + ' row / ' + + (columnIndex + 1) + ' column. The Header name should be ' + valueConfig.name ); } @@ -94,23 +92,20 @@ file.inValidMessages.push( _isFunction(valueConfig.requiredError) ? valueConfig.requiredError(valueConfig.name, rowIndex + 1, columnIndex + 1) - : String(`${valueConfig.name} is required in the ${rowIndex + 1} row/ - ${columnIndex + 1} column`) + : String(valueConfig.name + ' is required in the ' + (rowIndex + 1) + ' row / ' + (columnIndex + 1) + ' column') ); } else if (valueConfig.validate && !valueConfig.validate(columnValue)) { file.inValidMessages.push( _isFunction(valueConfig.validateError) ? valueConfig.validateError(valueConfig.name, rowIndex + 1, columnIndex + 1) - : String(`${valueConfig.name} is not valid in the ${rowIndex + 1} row/ - ${columnIndex + 1} column`) + : String(valueConfig.name + ' is not valid in the ' + (rowIndex + 1) + ' row / ' + (columnIndex + 1) + ' column') ); } else if (valueConfig.dependentValidate && !valueConfig.dependentValidate(columnValue, _getClearRow(row))) { file.inValidMessages.push( _isFunction(valueConfig.validateError) ? valueConfig.validateError(valueConfig.name, rowIndex + 1, columnIndex + 1) - : String(`${valueConfig.name} not passed dependent validation in the ${rowIndex + 1} row/ - ${columnIndex + 1} column`) + : String(valueConfig.name + ' not passed dependent validation in the ' + (rowIndex + 1) + ' row / ' + (columnIndex + 1) + ' column') ); } From 87675b50fc8296eb1a59cbe16ee6716cb59fc5ed Mon Sep 17 00:00:00 2001 From: shystruk Date: Wed, 8 Dec 2021 15:56:21 -0800 Subject: [PATCH 2/2] 1.13.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c4d4bc..a3a01be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "csv-file-validator", - "version": "1.13.0", + "version": "1.13.1", "description": "Validation of CSV file against user defined schema (returns back object with data and invalid messages)", "main": "./src/csv-file-validator.js", "types": "./src/csv-file-validator.d.ts",