const fileTypeCheck = (file: File, fileType: string[]) => {
  const type = file.name.split('.').pop() || '';

  return fileType.includes(type.toLowerCase());
};

const fileSizeCheck = (file: File, limitFileSize: number) => {
  if (file.size > (limitFileSize * 1024 * 1024)) {
    return false;
  }

  return true;
};

const fileNameCheck = (file: File) => {
  const regType = /^[A-Za-z0-9+]*$/;

  return regType.test(file.name.split('.')[0]);
};

const isVideo = (src: string) => {
  return src.includes('mp4');
};

export default {
  fileTypeCheck,
  fileSizeCheck,
  fileNameCheck,
  isVideo
};
