iiif-prezi2to3
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

IIIF Presentation v2 to v3 converter (Javascript)

Travis npm package Coveralls

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.

demo

Istallation

Installing via npm:

npm install iiif-prezi2to3

Installing using yarn:

yarn add iiif-prezi2to3

Usage

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 : The description property is not a summary, and hence should be put in as a metadata pair. The label generated will be "Description". The default is true.
  • related_2_md : The related property is not a homepage, and hence should be put in as a metadata pair. The label generated will be "Related". The default is false (and hence the property will simply be renamed as homepage)
  • ext_ok : Should extensions be copied through to the new version. The default is false.
  • default_lang : The default language to use for language maps. The default is "@none".
  • deref_links : Should links without a format property be dereferenced and the HTTP response inspected for the media type? The default is true.
  • debug : Are we in debug mode and should spit out more warnings than normal? The default is false

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

Readme

Keywords

none

Package Sidebar

Install

npm i iiif-prezi2to3

Weekly Downloads

3

Version

2.0.2

License

MIT

Unpacked Size

102 kB

Total Files

7

Last publish

Collaborators

  • adam-digirati