import formats from '$lib/common/supportedFormats.json'; const formatMime = new Map(Object.entries(formats)) export const isURLValid = (url: string) => { try { new URL(url) } catch { return false } return true; } export const mimeTypeMap = formatMime; export const contentTypeFromFormat = (format: string): string => { const toReturn: string | undefined = formatMime.get(format) if (!toReturn) { throw new Error("Unsupported format") } return toReturn; }