Skip to content

Commit

Permalink
[input:wikidata] Added guard for empty values
Browse files Browse the repository at this point in the history
See #50 (1)
  • Loading branch information
larsgw committed Jun 3, 2017
1 parent 2a52231 commit 9825abf
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/parse/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", {
var parseDate = function parseDate(value) {
var date = new Date(value);
return [{
'date-parts': [date.getFullYear(), date.getMonth() + 1, date.getDate()]
'date-parts': date.getFullYear() ? [date.getFullYear(), date.getMonth() + 1, date.getDate()] : []
}];
};

Expand Down
2 changes: 1 addition & 1 deletion lib/parse/wikidata/async/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ var parseWikidataPropAsync = function () {
return _context3.abrupt('break', 7);

case 5:
value = value[0].value;
value = value.length ? value[0].value : undefined;
return _context3.abrupt('break', 7);

case 7:
Expand Down
2 changes: 1 addition & 1 deletion lib/parse/wikidata/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var parseWikidataProp = function parseWikidataProp(prop, value, lang) {
break;

default:
value = value[0].value;
value = value.length ? value[0].value : undefined;
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/parse/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
const parseDate = function (value) {
const date = new Date(value)
return [{
'date-parts': [date.getFullYear(), date.getMonth() + 1, date.getDate()]
'date-parts': date.getFullYear() ? [date.getFullYear(), date.getMonth() + 1, date.getDate()] : []
}]
}

Expand Down
2 changes: 1 addition & 1 deletion src/parse/wikidata/async/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const parseWikidataPropAsync = async function (prop, value, lang) {
break

default:
value = value[ 0 ].value
value = value.length ? value[0].value : undefined
break
}

Expand Down
2 changes: 1 addition & 1 deletion src/parse/wikidata/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const parseWikidataProp = function (prop, value, lang) {
break

default:
value = value[ 0 ].value
value = value.length ? value[0].value : undefined
break
}

Expand Down

0 comments on commit 9825abf

Please sign in to comment.