feat(Validations: add validations for documents, Twitter links, Youtube links , Twitch Link, Github links, Instagram links

This commit is contained in:
Aminejv 2021-09-24 17:59:08 +01:00
parent 3be39eccc4
commit 64347b4dc5

View File

@ -265,6 +265,9 @@ export const isMarkdown = (filename = "", type = "") => {
return filename.toLowerCase().endsWith(".md") || type.startsWith("text/plain");
};
export const isDocument = (fileName = "", type = "") =>
isMarkdown(fileName, type) || isPdfType(type) || isEpubType(type);
export const isUnityFile = async (file) => {
try {
const zip = new JSZip();
@ -288,3 +291,9 @@ export const isNFTLink = (file) => {
domain = domain.toLowerCase();
return Constants.NFTDomains.includes(domain);
};
const isLinkWithSource = (source) => (file) => file.isLink && file.data.source === source;
export const isTwitterLink = isLinkWithSource("Twitter");
export const isYoutubeLink = isLinkWithSource("YouTube");
export const isTwitchLink = isLinkWithSource("Twitch");
export const isGithubLink = isLinkWithSource("GitHub");
export const isInstagramLink = isLinkWithSource("Instagram");