cuba
cuba copied to clipboard
TypeError when parsing a row: parse-row.js
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.
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.