Skip to content

Commit

Permalink
Merge pull request #37 from ZJONSSON/optional-undefined
Browse files Browse the repository at this point in the history
Don't error if an optional value is `undefined` or `null`
  • Loading branch information
kessler authored Feb 11, 2018
2 parents 57ebf09 + 50243bb commit 1fa58b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/shred.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function shredRecordInternal(fields, record, data, rlvl, dlvl) {

// fetch values
let values = [];
if (record && (fieldName in record)) {
if (record && (fieldName in record) && record[fieldName] !== undefined && record[fieldName] !== null) {
if (record[fieldName].constructor === Array) {
values = record[fieldName];
} else {
Expand Down
1 change: 1 addition & 0 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function mkTestRows(opts) {
rows.push({
name: 'kiwi',
price: 4.2,
quantity: undefined,
day: new Date('2017-11-26'),
date: new Date(TEST_VTIME + 8000 * i),
finger: "FNORD",
Expand Down

0 comments on commit 1fa58b5

Please sign in to comment.