"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = getExt;

function _fileTypesPlugins() {
  const data = _interopRequireDefault(require("../../plugins/file-types-plugins"));

  _fileTypesPlugins = function () {
    return data;
  };

  return data;
}

function getExt(filename) {
  const foundPlugin = _fileTypesPlugins().default.find(plugin => filename.endsWith(`.${plugin.getExtension()}`));

  if (foundPlugin) return foundPlugin.getExtension();
  return filename.substring(filename.lastIndexOf('.') + 1, filename.length); // +1 to remove the '.'
}