redux-persist-2
Version:
persist and rehydrate redux stores
28 lines (23 loc) • 785 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function createTransform(inbound, outbound) {
var config = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var whitelist = config.whitelist || null;
var blacklist = config.blacklist || null;
function whitelistBlacklistCheck(key) {
if (whitelist && whitelist.indexOf(key) === -1) return true;
if (blacklist && blacklist.indexOf(key) !== -1) return true;
return false;
}
return {
in: function _in(state, key) {
return !whitelistBlacklistCheck(key) ? inbound(state, key) : state;
},
out: function out(state, key) {
return !whitelistBlacklistCheck(key) ? outbound(state, key) : state;
}
};
}
exports.default = createTransform;