"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _isEqual = _interopRequireDefault(require("lodash/isEqual"));

var _this = void 0;

var _default = function _default(fn) {
  var prevArgs = null;
  var cachedValue;
  return function () {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

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

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

exports.default = _default;