'use strict';

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

var _fileTypesPlugins;

function _load_fileTypesPlugins() {
  return _fileTypesPlugins = _interopRequireDefault(require('../../plugins/file-types-plugins'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function getExt(filename) {
  var foundPlugin = (_fileTypesPlugins || _load_fileTypesPlugins()).default.find(function (plugin) {
    return filename.endsWith(`.${plugin.getExtension()}`);
  });
  if (foundPlugin) return foundPlugin.getExtension();
  return filename.substring(filename.lastIndexOf('.') + 1, filename.length); // +1 to remove the '.'
}