Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
version = -1,
key = 'root', // TODO verify
whitelist = undefined,
blacklist = undefined,
mutateKeys = undefined,
mutateValues = undefined,
migrate = (s: any, v: number) => Promise.resolve(s),
stateReconciler = (s: any, o: any, r: any, c: any) => s,
} = persistOptions || {};
const prefix = `persist:${key}`;
const reduxPersistKey = `redux-persist`;
const migrateReduxPersistKey = mutateKeysLayer(
(key) => (key === `${prefix}.${reduxPersistKey}` ? prefix : key),
(key) => (key === prefix ? `${prefix}.${reduxPersistKey}` : key),
);
const internalMutateKeys = [migrateReduxPersistKey, prefixLayer(prefix)];
if (whitelist) {
internalMutateKeys.push(filterKeys((key) => whitelist.includes(key)));
}
if (blacklist) {
internalMutateKeys.push(filterKeys((key) => !blacklist.includes(key)));
}
const customMutateKeys = mutateKeys ? internalMutateKeys.concat(mutateKeys) : internalMutateKeys;
const cache: ICache = new Cache({
disablePersist,
prefix: null,
mutateKeys: customMutateKeys,
mutateValues,
initialState: preloadedState,
mergeState: async (originalRestoredState = {}, initialState = {}) => {