redux-deep-persist
Advanced tools
Comparing version
@@ -281,17 +281,4 @@ "use strict"; | ||
const configValidator = function ({ whitelist, blacklist }) { | ||
if (whitelist && blacklist) { | ||
const foundKeys = whitelist | ||
.map((path) => { | ||
const pathArray = path.split('.'); | ||
const rootKey = pathArray[0]; | ||
if (blacklist.some((path) => path.split('.')[0] === rootKey)) { | ||
return rootKey; | ||
} | ||
}) | ||
.filter((value, index, self) => { | ||
return value && self.indexOf(value) === index; | ||
}); | ||
if (foundKeys === null || foundKeys === void 0 ? void 0 : foundKeys.length) { | ||
throw new Error(`${constants_1.PACKAGE_NAME}: whitelisted root keys also found in the blacklist.\n\n ${JSON.stringify(foundKeys)}`); | ||
} | ||
if (whitelist && whitelist.length && blacklist && blacklist.length) { | ||
throw new Error(`${constants_1.PACKAGE_NAME}: you should not define a whitelist and blacklist in parallel. It is allowed to use only one of these lists per config.`); | ||
} | ||
@@ -298,0 +285,0 @@ if (whitelist) { |
{ | ||
"name": "redux-deep-persist", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Allows to easily create a deep configuration of a whitelist or blacklist for the redux-persist module.", | ||
@@ -5,0 +5,0 @@ "author": "Piotr Kujawa <piotrkujawa.dev@gmail.com>", |
@@ -88,6 +88,6 @@ # Redux Deep Persist | ||
* **"Whitelisted root keys also found in the blacklist."** | ||
* **"You should not define a whitelist and blacklist in parallel."** | ||
- _it occurs when you try to use whitelist and blacklist at once, you should choose just one approach_ | ||
* **"Duplicates of paths found in your whitelist/blacklist"** | ||
* **"Duplicates of paths found in your whitelist/blacklist."** | ||
- _you defined duplicated paths in your whitelist or blacklist arrays. Wrong: ```["root1", "root2.a2", "root1"]```._ | ||
@@ -94,0 +94,0 @@ |
@@ -386,21 +386,6 @@ import { PACKAGE_NAME, PLACEHOLDER_UNDEFINED } from '../constants'; | ||
// 1. Find duplicated root keys within whitelist and blacklist | ||
if (whitelist && blacklist) { | ||
const foundKeys = whitelist | ||
.map((path) => { | ||
const pathArray = path.split('.'); | ||
const rootKey = pathArray[0]; | ||
if (blacklist.some((path) => path.split('.')[0] === rootKey)) { | ||
return rootKey; | ||
} | ||
}) | ||
.filter((value, index, self) => { | ||
return value && self.indexOf(value) === index; | ||
}); | ||
if (foundKeys?.length) { | ||
throw new Error( | ||
`${PACKAGE_NAME}: whitelisted root keys also found in the blacklist.\n\n ${JSON.stringify(foundKeys)}`, | ||
); | ||
} | ||
if (whitelist && whitelist.length && blacklist && blacklist.length) { | ||
throw new Error( | ||
`${PACKAGE_NAME}: you should not define a whitelist and blacklist in parallel. It is allowed to use only one of these lists per config.`, | ||
); | ||
} | ||
@@ -407,0 +392,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
86726
-1.54%1287
-1.98%