cuba icon indicating copy to clipboard operation
cuba copied to clipboard

TypeError when parsing a row: parse-row.js

Open hunsoo opened this issue 5 years ago • 1 comments

TypeError: Cannot read property 'v' of null
    at ...../node_modules/cuba/src/parse-row.js:10:71

This happens when checking for null with:

result[schema[index]] = transform(typeof cell === 'object' ? cell.v : null)

When you do typeof null, you get 'object'. It can be fixed by checking for the null with double negation, because the cell is either an object literal (which always returns true when used in conditional statements) or null:

result[schema[index]] = transform(!!cell ? cell.v : null) 

This works fine with my data.

hunsoo avatar Jan 07 '20 07:01 hunsoo

I have the same issue. @yuanqing what would you say about the suggestion above? It would be great to fix this in the package itself.

Exiliot avatar Dec 11 '20 21:12 Exiliot