import _Object$keys from 'babel-runtime/core-js/object/keys';
import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray';
export var moveItem = function moveItem(itemArray, targetPosition, sourceIndex) {

  var newArray = [].concat(_toConsumableArray(itemArray.slice(0, sourceIndex)), _toConsumableArray(itemArray.slice(sourceIndex + 1)));

  if (targetPosition > sourceIndex) {
    return [].concat(_toConsumableArray(newArray.slice(0, targetPosition - 1)), [itemArray[sourceIndex]], _toConsumableArray(newArray.slice(targetPosition - 1)));
  }

  return [].concat(_toConsumableArray(newArray.slice(0, targetPosition)), [itemArray[sourceIndex]], _toConsumableArray(newArray.slice(targetPosition)));
};

export var omit = function omit(obj) {
  for (var _len = arguments.length, keysToOmit = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    keysToOmit[_key - 1] = arguments[_key];
  }

  return _Object$keys(obj).reduce(function (acc, key) {
    if (keysToOmit.indexOf(key) === -1) acc[key] = obj[key];
    return acc;
  }, {});
};

export var getDisplayName = function getDisplayName(WrappedComponent) {
  return WrappedComponent.displayName || WrappedComponent.name || 'Component';
};

export var isEdge = function isEdge() {
  // copied from: https://stackoverflow.com/questions/33152523/how-do-i-detect-ie-and-edge-browser
  return document.documentMode || /Edge/.test(navigator.userAgent);
};