'use strict';

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

var _ramda;

function _load_ramda() {
  return _ramda = _interopRequireDefault(require('ramda'));
}

var _vinyl;

function _load_vinyl() {
  return _vinyl = _interopRequireDefault(require('vinyl'));
}

var _;

function _load_() {
  return _ = require('../');
}

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

function searchFilesIgnoreExt(files, fileName, fileNameProp, returnProp) {
  var _byFileNoExt = function _byFileNoExt(file) {
    var fileNameToCheck = fileNameProp ? file[fileNameProp] : file;
    return (0, (_ || _load_()).getWithoutExt)(fileNameToCheck) === (0, (_ || _load_()).getWithoutExt)(fileName);
  };

  if (files && !(_ramda || _load_ramda()).default.isEmpty(files)) {
    var foundFile = (_ramda || _load_ramda()).default.find(_byFileNoExt, files);
    var foundFileResult = foundFile && returnProp && foundFile[returnProp] ? foundFile[returnProp] : foundFile;
    return foundFileResult;
  }
  return null;
}