Skip to content

Commit

Permalink
fix(plugin-wikidata): fix getting label if no title exists (#32)
Browse files Browse the repository at this point in the history
Fix code getting labels if no explicit title exists.The current code broke if a Wikidata item had no explicit title (e.g. Q1).
  • Loading branch information
nichtich authored and larsgw committed Apr 14, 2019
1 parent 0567ece commit 69243c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-wikidata/src/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ function addValues (data, prop, value) {
}
}

function postProcess (data, { labels }, langs) {
function postProcess (data, entity, langs) {
for (let prop in data) {
if (Array.isArray(data[prop])) {
data[prop].sort(({ _ordinal: a }, { _ordinal: b }) => a - b)
}
}

if (!data.title) {
data.title = getLabel(langs)
data.title = getLabel(entity, langs)
}

return data
Expand Down

0 comments on commit 69243c5

Please sign in to comment.