mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-06-30 15:56:58 +00:00
18 lines
453 B
TypeScript
18 lines
453 B
TypeScript
import {
|
|
ArchivedFormat,
|
|
LinkIncludingShortenedCollectionAndTags,
|
|
} from "@linkwarden/types/global";
|
|
|
|
const getOriginalFormat = (
|
|
link: LinkIncludingShortenedCollectionAndTags
|
|
): ArchivedFormat | null => {
|
|
if (link.type === "pdf") return ArchivedFormat.pdf;
|
|
else if (link.type === "image")
|
|
return link.image?.endsWith("png")
|
|
? ArchivedFormat.png
|
|
: ArchivedFormat.jpeg;
|
|
else return null;
|
|
};
|
|
|
|
export default getOriginalFormat;
|