Skip to content

Commit

Permalink
added validation to make sure that rowValue is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
KwonIan committed Sep 17, 2024
1 parent 9b28e30 commit 8aba54d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/utils/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,14 @@ export const initColumns = (columns: Column[], disableRichColumnHeaders?: boolea
case ColumnFormat.EMAIL:
c.cell = (row: any) => {
const rowValue = getRowValueFromSelectorString(c.selector, row);
const firstAuthor =
//typeof rowValue === 'string' && rowValue.includes(',') ? rowValue.split(',')[0] : '';
typeof rowValue === 'string' && rowValue.includes(',')
? rowValue.split(',')[0]
: rowValue;
if (typeof rowValue === 'string') {
const firstAuthor =
typeof rowValue === 'string' && rowValue.includes(',')
? rowValue.split(',')[0]
: rowValue;
} else {
const firstAuthor = '';
}
let emailAddressPart = '';
if (c && c.formatOptions && typeof row[c.formatOptions.emailAddressKey] === 'string') {
const parts = row[c.formatOptions.emailAddressKey].split(':');
Expand Down

0 comments on commit 8aba54d

Please sign in to comment.