You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

redux-persist-transform-filter-immutable

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-persist-transform-filter-immutable

Filter transformator for redux-persist supporting immutable.js

0.3.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

redux-persist-transform-filter-immutable

Filter transformator for redux-persist supporting immutable.js

Installation

  npm install redux-persist-transform-filter-immutable

Usage

import createFilter 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 load only a subset of your state of reducer two
const loadSubsetFilter = createFilter(
  'myReducerTwo',
  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(
  'myReducerThree',
  ['one', 'two']
  ['three', 'four']
);

// deeply nested values can be used via arrays as path
const nestedSubsetFilter = createFilter(
  'myReducerThree',
  [['my', 'path'], ['my', 'other', 'path']],
  [['my', 'path'], ['my', 'other', 'path']]
);

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

Thanks

Thanks to Eduard Baun for redux-persist-transform-filter - on which this implementation is based.

Keywords

react

FAQs

Package last updated on 08 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts