Skip to content

Commit 57913f3

Browse files
committed
refactor(CTable): improve and clean-up syntax
1 parent ac6ac5a commit 57913f3

File tree

1 file changed

+2
-7
lines changed
  • packages/coreui-react/src/components/table

1 file changed

+2
-7
lines changed

packages/coreui-react/src/components/table/utils.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ export const pretifyName = (name: string) => {
1111
}
1212

1313
export const getColumnLabel = (column: Column | string) =>
14-
typeof column === 'object'
15-
? column.label !== undefined
16-
? column.label
17-
: pretifyName(column.key)
18-
: pretifyName(column)
14+
typeof column === 'object' ? column.label ?? pretifyName(column.key) : pretifyName(column)
1915

2016
export const getColumnNames = (columns: (string | Column)[] | undefined, items?: Item[]) =>
2117
columns
2218
? columns.map((column: Column | string) => {
23-
if (typeof column === 'object') return column.key
24-
else return column
19+
return typeof column === 'object' ? column.key : column
2520
})
2621
: items && getColumnNamesFromItems(items)
2722

0 commit comments

Comments
 (0)