UNPKG

cozy-iiif

Version:

A developer-friendly collection of abstractions and utilities built on top of @iiif/presentation-3 and @iiif/parser

11 lines (9 loc) 431 B
import { getPropertyValue } from '../core'; import type { Level0ImageServiceResource } from '../types'; import type { ImageInfo } from './types'; const toImageInfo = (resource: any) => { const id = getPropertyValue(resource, 'id'); return { id, ...resource }; } export const fetchImageInfo = (resource: Level0ImageServiceResource): Promise<ImageInfo> => fetch(resource.serviceUrl).then(res => res.json()).then(toImageInfo);