better code
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 16s
All checks were successful
Bump deps (only minor versions) / ci (push) Successful in 16s
This commit is contained in:
parent
b16b84e5a3
commit
6b8779f527
2 changed files with 37 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue