Skip to content
Snippets Groups Projects
Unverified Commit 2af0a4e6 authored by Glenn Fischer's avatar Glenn Fischer Committed by GitHub
Browse files

Merge pull request #1911 from ProjectMirador/fix-get-metadata-selector

Fix metadata selector
parents 5edb867b 8d0038b0
Branches
Tags
No related merge requests found
...@@ -150,19 +150,18 @@ export function getCanvasLabel(canvas, canvasIndex) { ...@@ -150,19 +150,18 @@ export function getCanvasLabel(canvas, canvasIndex) {
} }
/** /**
* Return canvas metadata in a label / value structure * Return metadata in a label / value structure
* This is a potential seam for pulling the i18n locale from * This is a potential seam for pulling the i18n locale from
* state and plucking out the appropriate language. * state and plucking out the appropriate language.
* For now we're just getting the first. * For now we're just getting the first.
* @param {object} IIIF Resource * @param {object} Manifesto IIIF Resource (e.g. canvas, manifest)
* @return {Array[Object]} * @return {Array[Object]}
*/ */
export function getDestructuredMetadata(iiifResoruce) { export function getDestructuredMetadata(iiifResource) {
return (iiifResoruce return (iiifResource
&& iiifResoruce.getMetadata() && iiifResource.getMetadata().map(labelValuePair => ({
&& iiifResoruce.getMetadata().map(resource => ({ label: labelValuePair.getLabel(),
label: resource.label[0].value, value: labelValuePair.getValue(),
value: resource.value[0].value,
})) }))
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment