'use strict';

var getFileType = require('../getFileType/getFileType.js');

function isTypeValid(file, rule, file64) {
  if (!rule) {
    return false;
  }
  const allowedTypes = rule.replace(/\s/g, '').split(',');
  const fileType = getFileType.getFileType(file, file64);
  if (rule === '*' || allowedTypes.includes(fileType)) {
    return true;
  }
  return allowedTypes.some(type => {
    const [typeAllowed, extensionAllowed] = type.split('/');
    return extensionAllowed === '*' && fileType.includes(typeAllowed);
  });
}

exports.isTypeValid = isTypeValid;
//# sourceMappingURL=isTypeValid.js.map
