wipe-node-cache
Advanced tools
Comparing version 2.1.0 to 2.1.1
"use strict"; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function waveCallback_default() { | ||
@@ -15,3 +17,3 @@ return true; | ||
var parent = modules[moduleName]; | ||
var line = parent.children; | ||
var line = parent.children || []; | ||
line.forEach(function (_ref) { | ||
@@ -48,4 +50,4 @@ var childName = _ref.id; | ||
function purge(cache, wipeList, callback, removeFromCache) { | ||
burn(cache, wipeList, assignParents(cache), callback, removeFromCache); | ||
function purge(cache, wipeList, callback, removeFromCache, parents) { | ||
burn(cache, wipeList, parents || assignParents(cache), callback, removeFromCache); | ||
} | ||
@@ -93,7 +95,10 @@ | ||
var wipeList = []; | ||
callback(buildIndexForward(cache), function (name) { | ||
var parents = assignParents(cache); | ||
var simpleIndex = buildIndexForward(cache); | ||
var compositeIndex = [].concat(_toConsumableArray(new Set([].concat(_toConsumableArray(simpleIndex), _toConsumableArray(Object.keys(parents)))))); | ||
callback(compositeIndex, function (name) { | ||
removeFromCache(name); | ||
wipeList.push(name); | ||
}); | ||
return purge(cache, wipeList, waveCallback); | ||
return purge(cache, wipeList, waveCallback, undefined, parents); | ||
} | ||
@@ -100,0 +105,0 @@ |
{ | ||
"name": "wipe-node-cache", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Wipes node.js cache in a controled way.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -13,3 +13,3 @@ function waveCallback_default() { | ||
const parent = modules[moduleName]; | ||
const line = parent.children; | ||
const line = parent.children || []; | ||
line.forEach(({id: childName}) => { | ||
@@ -42,4 +42,4 @@ result[childName] = result[childName] || {parents: []}; | ||
function purge(cache, wipeList, callback, removeFromCache) { | ||
burn(cache, wipeList, assignParents(cache), callback, removeFromCache); | ||
function purge(cache, wipeList, callback, removeFromCache, parents) { | ||
burn(cache, wipeList, parents || assignParents(cache), callback, removeFromCache); | ||
} | ||
@@ -88,7 +88,10 @@ | ||
const wipeList = []; | ||
callback(buildIndexForward(cache), name => { | ||
const parents = assignParents(cache); | ||
const simpleIndex = buildIndexForward(cache); | ||
const compositeIndex = [...new Set([...simpleIndex, ...Object.keys(parents)])]; | ||
callback(compositeIndex, name => { | ||
removeFromCache(name); | ||
wipeList.push(name); | ||
}); | ||
return purge(cache, wipeList, waveCallback); | ||
return purge(cache, wipeList, waveCallback, undefined, parents); | ||
} | ||
@@ -95,0 +98,0 @@ |
@@ -6,3 +6,3 @@ /*jshint asi:true*/ | ||
var assert = require('assert'); | ||
const {wipeCache:wipe} = require('../index'); | ||
const {wipeCache:wipe} = require('../src/index'); | ||
@@ -9,0 +9,0 @@ var stubs = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
322
14505
12