better code
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 16s

This commit is contained in:
0d0 2025-02-23 05:22:37 +01:00
parent b16b84e5a3
commit 6b8779f527
2 changed files with 37 additions and 7 deletions

View file

@ -1,7 +1,15 @@
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)