mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-06-28 14:55:49 +00:00
21 lines
646 B
TypeScript
21 lines
646 B
TypeScript
import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types/global";
|
|
import { Link } from "@linkwarden/prisma/client";
|
|
|
|
export function formatAvailable(
|
|
link: Link | LinkIncludingShortenedCollectionAndTags,
|
|
format: "image" | "pdf" | "readable" | "monolith" | "preview"
|
|
) {
|
|
return Boolean(link && link[format] && link[format] !== "unavailable");
|
|
}
|
|
|
|
export const atLeastOneFormatAvailable = (
|
|
link: Link | LinkIncludingShortenedCollectionAndTags
|
|
) => {
|
|
return (
|
|
formatAvailable(link, "image") ||
|
|
formatAvailable(link, "pdf") ||
|
|
formatAvailable(link, "readable") ||
|
|
formatAvailable(link, "monolith")
|
|
);
|
|
};
|