function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import { pickBy } from "lodash";
import { createSelector } from "reselect";
import { getLowerCaseObj } from "../utils/arrayUtils";
import { getCustomEnzymes } from "../utils/editorUtils";
export default createSelector(function () {
  return window.localStorage.getItem("customEnzymes");
}, function (state, additionalEnzymes) {
  return additionalEnzymes;
}, function (customEnzymesString, additionalEnzymes) {
  return getLowerCaseObj(pickBy(_extends({}, additionalEnzymes, getCustomEnzymes(customEnzymesString)), function (val, key) {
    if (!val) {
      console.error("43ti3523: Error: Missing enzyme data for key: ", key, "Ignoring this enzyme");
      return false;
    }

    // eslint-disable-next-line no-unused-vars
    for (var _i = 0, _arr = ["forwardRegex", "reverseRegex", "topSnipOffset", "bottomSnipOffset", "site"]; _i < _arr.length; _i++) {
      var prop = _arr[_i];
      if (val[prop] === undefined || val[prop] === null) {
        console.error("23483g93h Error: Missing property " + prop + " for enzyme " + key + ". Ignoring this enzyme");
        return false;
      }
    }
    return true;
  }));
});