Skip to content

Commit

Permalink
Merge pull request #400 from lineupjs/thinkh/399_fix-empty-array-in-d…
Browse files Browse the repository at this point in the history
…ataset

Fix derive column type for dataset properties with `[]` or `null`
  • Loading branch information
thinkh committed Nov 24, 2020
2 parents 668f6e8 + 07fef7b commit 174b8e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/provider/utils.ts
Expand Up @@ -190,7 +190,7 @@ function deriveType(label: string, value: any, column: number | string, all: ()

// check boxplot
const bs = ['min', 'max', 'median', 'q1', 'q3'];
if (typeof value === 'object' && bs.every((b) => typeof value[b] === 'number')) {
if (value !== null && typeof value === 'object' && bs.every((b) => typeof value[b] === 'number')) {
// boxplot
const vs = all();
return Object.assign(base, {
Expand All @@ -202,7 +202,7 @@ function deriveType(label: string, value: any, column: number | string, all: ()
});
}

if (typeof value === 'object') {
if (value !== null && typeof value === 'object') {
// object map
const first = Object.keys(value).map((k) => value[k]).filter((d) => !isEmpty(d));
const mapAll = () => {
Expand Down

0 comments on commit 174b8e4

Please sign in to comment.