UNPKG

@allmaps/annotation

Version:

Functions for generating and parsing IIIF georeference annotations

41 lines (40 loc) 1.1 kB
export function isGeoreferencedMapsBeforeParse(mapOrMaps) { return Array.isArray(mapOrMaps); } export function isAnnotationPageBeforeParse(annotation) { if (annotation && typeof annotation === 'object' && 'type' in annotation && annotation.type === 'AnnotationPage' && 'items' in annotation) { return true; } else { return false; } } export function isGeoreferencedMap2BeforeParse(georeferencedMap) { if (georeferencedMap && typeof georeferencedMap === 'object' && 'type' in georeferencedMap && georeferencedMap.type === 'GeoreferencedMap') { return true; } else { return false; } } export function isAnnotation0BeforeParse(annotation) { if (annotation && typeof annotation === 'object' && 'target' in annotation && annotation.target && typeof annotation.target === 'object' && 'source' in annotation.target && typeof annotation.target.source === 'string') { return true; } else { return false; } }