2.0.2 • Published 5 years ago
iiif-prezi2to3 v2.0.2
IIIF Presentation v2 to v3 converter (Javascript)
The library is a direct javascript port of the IIIF/prezi-2-to-3, therefore it converts json-ld documents from IIIF Presentation v2 to v3.
Istallation
Installing via npm:
npm install iiif-prezi2to3Installing using yarn:
yarn add iiif-prezi2to3Usage
Importing
Using with require:
var Upgrader = require('iiif-prezi2to3');Using with es6 imports:
import Upgrader from 'iiif-prezi2to3';From browser:
<script src="https://unpkg.com/iiif-prezi2to3/umd/iiif-prezi2to3.js" type="text/javascript"></script>Instantiating
Convert javascript JSON:
let upgrader = new Upgrader({"deref_links " : false});Converting
Processing in memory objects:
let resultObject = upgrader.processResource(input_manifest, true);Processing urls:
let resultObject = upgrader.processUri(uri, true);Constuctor flags
desc_2_md: Thedescriptionproperty is not a summary, and hence should be put in as ametadatapair. The label generated will be "Description". The default istrue.related_2_md: Therelatedproperty is not a homepage, and hence should be put in as ametadatapair. The label generated will be "Related". The default isfalse(and hence the property will simply be renamed as homepage)ext_ok: Should extensions be copied through to the new version. The default isfalse.default_lang: The default language to use for language maps. The default is"@none".deref_links: Should links without aformatproperty be dereferenced and the HTTP response inspected for the media type? The default istrue.debug: Are we in debug mode and should spit out more warnings than normal? The default isfalse
TODO/Roadmap
- Increase code coverage
- Rewrite tests using JEST
- Drop nwb.
- Add typings.
- Reduce cyclomatic complexity for several functions including:
- traverse
- fixServiceType
- fixType
- fixObject
- processGeneric
- setRemoteType
- processRange
- processAnnotation
- processResource