Skip to content
Snippets Groups Projects
Commit a61273b5 authored by Richard Doe's avatar Richard Doe
Browse files

Document and lint annotationListUris

parent 6ef2b536
No related branches found
No related tags found
No related merge requests found
...@@ -34,17 +34,19 @@ export default class ManifestoCanvas { ...@@ -34,17 +34,19 @@ export default class ManifestoCanvas {
return this.canvas.getWidth() / this.canvas.getHeight(); return this.canvas.getWidth() / this.canvas.getHeight();
} }
/** */ /**
* Fetches AnnotationList URIs from canvas's otherContent property
*
* Supported otherContent types:
* - Objects having @type property of "sc:AnnotationList" and URI in @id
* - Strings being the URIs
*/
get annotationListUris() { get annotationListUris() {
return flatten( return flatten(
new Array(this.canvas.__jsonld.otherContent), // eslint-disable-line no-underscore-dangle new Array(this.canvas.__jsonld.otherContent), // eslint-disable-line no-underscore-dangle
) )
.filter((otherContent) => { .filter(otherContent => otherContent && (typeof otherContent === 'string' || otherContent['@type'] === 'sc:AnnotationList'))
return otherContent && (typeof otherContent === 'string' || otherContent['@type'] === 'sc:AnnotationList'); .map(otherContent => (typeof otherContent === 'string' ? otherContent : otherContent['@id']));
})
.map((otherContent) => {
return typeof otherContent === 'string' ? otherContent : otherContent['@id'];
});
} }
/** */ /** */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment