* * @param {Object[]} data a JSON object of the data to be mapped * @returns {Object[]} An array of objects of the data
(data)
| 92 | * @returns {Object[]} An array of objects of the data |
| 93 | */ |
| 94 | mapData (data) { |
| 95 | return data.map(d => |
| 96 | this.options.importMap.reduce((acc, m) => { |
| 97 | const columnData = d[m.fileColumn] |
| 98 | let importedValue = null |
| 99 | |
| 100 | if (columnData != null) { |
| 101 | if (this.options.trimWhitespaces && _.isString(columnData)) { |
| 102 | importedValue = columnData.trim() |
| 103 | } else if (_.isString(columnData)) { |
| 104 | importedValue = columnData |
| 105 | } else { |
| 106 | importedValue = columnData |
| 107 | } |
| 108 | |
| 109 | if (this.options.nullableValues.includes(importedValue.toString().toUpperCase().trim())) { |
| 110 | importedValue = null |
| 111 | } |
| 112 | } |
| 113 | acc[m.tableColumn] = importedValue |
| 114 | return acc |
| 115 | }, {}) |
| 116 | ) |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Take the data to be put into the table and format it for the insertQueryBuilder function in client |
no test coverage detected