elgerlambert / redux-localstorage

Store enhancer that syncs (a subset) of your Redux store state to localstorage.
MIT License
1.32k stars 107 forks source link

Added EncodedLocalStorage #17

Closed slybridges closed 8 years ago

slybridges commented 8 years ago

Thanks for the lib, it works great !

I have the case where I didn't want part of my state to be stored in plain text on localStorage.

So I created an EncodedLocalStorage that takes an encoder and decoder functions on top of the storage and stores the state as an encoded string and decodes it on the fly when reading it.

By default, if you don't specify any encoder/decoder function it will use basic base64 encoding.

If made PR #16 for that matter. Feel free to merge if you think that could be of interest of some (alternatively, we could also update the current localStorage to accept an encoder and decoder as optional and just store plain text if none are passed).

elgerlambert commented 8 years ago

Thanks @slybridges! I'm closing this issue in favour of #16.