@connected-home/redux-persist-transform-filter-immutable
Filter transformator for redux-persist supporting immutable.js
Last updated 2 years ago by beavis07 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @connected-home/redux-persist-transform-filter-immutable 
SYNC missed versions from official npm registry.

redux-persist-transform-filter-immutable

npm Build Status

Filter transformator for redux-persist supporting immutable.js

Installation

  npm install @actra-development-oss/redux-persist-transform-filter-immutable

Usage

import { createFilter, createBlacklistFilter } from 'redux-persist-transform-filter-immutable';

// this works too:
import createFilter, { createBlacklistFilter } from 'redux-persist-transform-filter-immutable';

// you want to store only a subset of your state of reducer one
const saveSubsetFilter = createFilter(
    'myReducerOne',
    ['keyYouWantToSave1', 'keyYouWantToSave2']
);

// you want to remove some keys before you save
const saveSubsetBlacklistFilter = createBlacklistFilter(
    'myReducerTwo',
    ['keyYouDontWantToSave1', 'keyYouDontWantToSave2']
);

// you want to load only a subset of your state of reducer two
const loadSubsetFilter = createFilter(
    'myReducerThree',
    null,
    ['keyYouWantToLoad1', 'keyYouWantToLoad2']
);

// saving a subset and loading a different subset is possible
// but doesn't make much sense because you'd load an empty state
const saveAndloadSubsetFilter = createFilter(
    'myReducerFour',
    ['one', 'two']
    ['three', 'four']
);

persistStore(store, {
    transforms: [
        saveSubsetFilter,
        saveSubsetBlacklistFilter,
        loadSubsetFilter,
        saveAndloadSubsetFilter,
    ]
});

Thanks

Thanks to Eduard Baun for redux-persist-transform-filter - on which this implementation is based. Thanks to Zack Story for redux-persist from which I took createTransform().

Current Tags

  • 2.0.0                                ...           latest (2 years ago)

1 Versions

  • 2.0.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (11)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |