Skip to content

Commit

Permalink
Merge pull request #1013 from habx/feature/6.13/improve-parsing
Browse files Browse the repository at this point in the history
APP-21873: Improve parsing to ignore ''
  • Loading branch information
habxtech authored Jun 14, 2021
2 parents a44885b + 8c9e8cf commit 344559a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/imex/import/useImportTable.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export const parseCell = (
}
return newCellValue
case 'number[]':
if (!isNotEmptyCell(rawCell)) {
return []
}
let formattedNumberArrayCell = options.format(rawCell)
if (!Array.isArray(formattedNumberArrayCell)) {
if (typeof formattedNumberArrayCell !== 'string') {
Expand All @@ -91,6 +94,9 @@ export const parseCell = (
})

case 'string[]':
if (!isNotEmptyCell(rawCell)) {
return []
}
let formattedStringArrayCell = options.format(rawCell)
if (!Array.isArray(formattedStringArrayCell)) {
if (typeof formattedStringArrayCell !== 'string') {
Expand Down Expand Up @@ -189,7 +195,7 @@ export const parseRawData = async <D extends { id?: string | number }>(
let cellError: string | null = null

const format = (value: any) =>
orderedColumns[index]?.meta?.imex?.format?.(value, row) ?? `${value}`
orderedColumns[index]?.meta?.imex?.format?.(value, row) ?? value

let newCellValue:
| string
Expand Down

0 comments on commit 344559a

Please sign in to comment.