mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-26 04:19:49 +03:00
feat(Validations: add validations for documents, Twitter links, Youtube links , Twitch Link, Github links, Instagram links
This commit is contained in:
parent
3be39eccc4
commit
64347b4dc5
@ -265,6 +265,9 @@ export const isMarkdown = (filename = "", type = "") => {
|
|||||||
return filename.toLowerCase().endsWith(".md") || type.startsWith("text/plain");
|
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) => {
|
export const isUnityFile = async (file) => {
|
||||||
try {
|
try {
|
||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
@ -288,3 +291,9 @@ export const isNFTLink = (file) => {
|
|||||||
domain = domain.toLowerCase();
|
domain = domain.toLowerCase();
|
||||||
return Constants.NFTDomains.includes(domain);
|
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");
|
||||||
|
Loading…
Reference in New Issue
Block a user