@citation-js/plugin-wikidata
Advanced tools
Comparing version 0.7.7 to 0.7.8
@@ -65,9 +65,18 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } | ||
function collectAdditionalIds(entity, needed) { | ||
const additionalIds = []; | ||
if (!needed) { | ||
return []; | ||
return additionalIds; | ||
} | ||
entity._needed = Object.assign(entity._needed || {}, needed); | ||
return Object.keys(entity.claims).filter(prop => prop in needed).flatMap(prop => entity.claims[prop].map(({ | ||
value | ||
}) => value.id || value)); | ||
for (const prop in entity.claims) { | ||
if (prop in needed) { | ||
for (const claim of entity.claims[prop]) { | ||
if (claim.value) { | ||
var _claim$value$id; | ||
additionalIds.push((_claim$value$id = claim.value.id) !== null && _claim$value$id !== void 0 ? _claim$value$id : claim.value); | ||
} | ||
} | ||
} | ||
} | ||
return additionalIds; | ||
} | ||
@@ -74,0 +83,0 @@ function completeResponse(entities, old) { |
@@ -74,9 +74,18 @@ "use strict"; | ||
function collectAdditionalIds(entity, needed) { | ||
const additionalIds = []; | ||
if (!needed) { | ||
return []; | ||
return additionalIds; | ||
} | ||
entity._needed = Object.assign(entity._needed || {}, needed); | ||
return Object.keys(entity.claims).filter(prop => prop in needed).flatMap(prop => entity.claims[prop].map(({ | ||
value | ||
}) => value.id || value)); | ||
for (const prop in entity.claims) { | ||
if (prop in needed) { | ||
for (const claim of entity.claims[prop]) { | ||
if (claim.value) { | ||
var _claim$value$id; | ||
additionalIds.push((_claim$value$id = claim.value.id) !== null && _claim$value$id !== void 0 ? _claim$value$id : claim.value); | ||
} | ||
} | ||
} | ||
} | ||
return additionalIds; | ||
} | ||
@@ -83,0 +92,0 @@ function completeResponse(entities, old) { |
{ | ||
"name": "@citation-js/plugin-wikidata", | ||
"version": "0.7.7", | ||
"version": "0.7.8", | ||
"description": "Plugin for Wikidata for Citation.js", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "3194082b7d6a3e77178299c9ba15d81ad4f0f715" | ||
"gitHead": "55823985553b48d9081dd48ae678f24e67b7fafa" | ||
} |
1334815
6666