"use strict";

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

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

function _module() {
  const data = _interopRequireDefault(require("module"));

  _module = function () {
    return data;
  };

  return data;
}

function _filterObject() {
  const data = _interopRequireDefault(require("./filter-object"));

  _filterObject = function () {
    return data;
  };

  return data;
}

// $FlowFixMe
// remove any cached module path for a module name (Module._pathCache)
function removeFromRequireCache(currentRequestName) {
  _module().default._pathCache = (0, _filterObject().default)(_module().default._pathCache, (val, key) => {
    const cachedRequestName = JSON.parse(key).request;
    return currentRequestName !== cachedRequestName;
  });
}