'use strict';

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

var _isEqual = require('lodash/isEqual');

var _isEqual2 = _interopRequireDefault(_isEqual);

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

exports.default = function (fn) {
  var prevArgs = null;
  var cachedValue = void 0;

  return function () {
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    if ((0, _isEqual2.default)(args, prevArgs)) {
      return cachedValue;
    }

    prevArgs = args;
    cachedValue = fn.apply(undefined, args);
    return cachedValue;
  };
};