index.js
function (options, fileExtension) {
  var getOptionsKey = function (options, fileExtension) {
    for (var prop in options) {
      var _prop = prop.toLowerCase();

      if ((options[_prop].hasOwnProperty('allowed_file_extensions') && options[_prop].allowed_file_extensions.indexOf(fileExtension) > -1) || (!options[_prop].hasOwnProperty('allowed_file_extensions') && _prop === fileExtension)) {
        return prop;
      }
    }

    return null;
  };

  if (isNestedStructure(options)) {
    var optionsKey = getOptionsKey(options, fileExtension);
    return optionsKey !== null ? options[optionsKey]: {};
  }

  return options;
}
function (options, fileExtension) {
  var getOptionsKey = function (options, fileExtension) {
    for (var prop in options) {
      var _prop = prop.toLowerCase();

      if ((options[_prop].hasOwnProperty('allowed_file_extensions') && options[_prop].allowed_file_extensions.indexOf(fileExtension) > -1) || (!options[_prop].hasOwnProperty('allowed_file_extensions') && _prop === fileExtension)) {
        return prop;
      }
    }

    return null;
  };

  if (isNestedStructure(options)) {
    var optionsKey = getOptionsKey(options, fileExtension);
    return optionsKey !== null ? options[optionsKey]: {};
  }

  return options;
}
function ( options , fileExtension ) { var getOptionsKey = function ( options , fileExtension ) { for ( var prop in options ) { var _prop = prop . toLowerCase ( ) ; if ( ( options [ _prop ] . hasOwnProperty ( 'allowed_file_extensions' ) && options [ _prop ] . allowed_file_extensions . indexOf ( fileExtension ) > - 1 ) || ( ! options [ _prop ] . hasOwnProperty ( 'allowed_file_extensions' ) && _prop === fileExtension ) ) { return prop ; } } return null ; } ; if ( isNestedStructure ( options ) ) { var optionsKey = getOptionsKey ( options , fileExtension ) ; return optionsKey !== null ? options [ optionsKey ] : { } ; } return options ; }
Method checks whether file's extension has corresponded configuration object.
@param  {Object} options       - configuration object.
@param  {String} fileExtension - file's extension.
@return {String|Object}        - object key or null.
Method checks whether file s extension has corresponded configuration object .