src/index.js
function wipeCache(stubs, resolver, waveCallback, removeFromCache = removeFromCache_nodejs) {
  waveCallback = waveCallback || waveCallback_default;
  const cache = require.cache;

  wipeMap(
    cache,
    (cache, callback) => cache.forEach(
      moduleName => resolver(stubs, moduleName) && callback(moduleName)
    ),
    waveCallback,
    removeFromCache
  );
}
function wipeCache(stubs, resolver, waveCallback, removeFromCache = removeFromCache_nodejs) {
  waveCallback = waveCallback || waveCallback_default;
  const cache = require.cache;

  wipeMap(
    cache,
    (cache, callback) => cache.forEach(
      moduleName => resolver(stubs, moduleName) && callback(moduleName)
    ),
    waveCallback,
    removeFromCache
  );
}
function wipeCache ( stubs , resolver , waveCallback , removeFromCache = removeFromCache_nodejs ) { waveCallback = waveCallback || waveCallback_default ; const cache = require . cache ; wipeMap ( cache , ( cache , callback ) => cache . forEach ( moduleName => resolver ( stubs , moduleName ) && callback ( moduleName ) ) , waveCallback , removeFromCache ) ; }
Wipes node.js module cache.
First it look for modules to wipe, and wipe them.
Second it looks for users of that modules and wipe them to. Repeat.
Use waveCallback to control secondary wave.
@param {Object} stubs Any objects, which will just be passed as first parameter to resolver.
@param {Function} resolver function(stubs, moduleName) which shall return true, if module must be wiped out.
@param {Function} [waveCallback] function(moduleName) which shall return false, if parent module must not be wiped.
Wipes node . js module cache . First it look for modules to wipe and wipe them . Second it looks for users of that modules and wipe them to . Repeat . Use waveCallback to control secondary wave .