0.1.2 • Published 3 years ago
webanno-compare-target-lists-pmb v0.1.2
webanno-compare-target-lists-pmb
Compare target lists of web annotations.
API
This module exports one function:
compareTargetLists(oldAnno, newAnno)
Takes two web annotations oldAnno and newAnno,
which should be objects that hold a target key with arbitrary value.
Ideally, the target values conform to the Web Annotation Data Model.
Returns a report, which is an object with these keys:
removed: Array of of targets that occurr only inoldAnno.added: Array of targets that occurr only innewAnno.commonInOld: Array of targets that occurr in both annotations, in the order they were found inoldAnno.commonInNew: Array of targets that occurr in both annotations, in the order they were found inoldAnno.commonSameOrder: Boolean, whether the lists of common targets are in same ordering. If there are no common targets, they are considered in same order.reordered: Boolean, whether the lists of common targets differ in ordering. Opposite ofcommonSameOrder. They come as a pair to help you make your script fail more safely in case of future API changes.
Usage
see test/usage.mjs. from test/usage.mjs: :TODO:
var webanno-compare-target-lists-pmb = require('webanno-compare-target-lists-pmb');
D.result = webanno-compare-target-lists-pmb(null);
D.expect('===', null);$ webanno-compare-target-lists-pmb foo
barKnown issues
- Needs more/better tests and docs.
License
ISC