Socket
Socket
Sign inDemoInstall

redux-persist-transform-filter-immutable

Package Overview
Dependencies
6
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-persist-transform-filter-immutable

Filter transformator for redux-persist supporting immutable.js


Version published
Weekly downloads
5K
increased by7.63%
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc