Gathering detailed insights and metrics for ruve-ngrx-store-localstorage
Gathering detailed insights and metrics for ruve-ngrx-store-localstorage
Gathering detailed insights and metrics for ruve-ngrx-store-localstorage
Gathering detailed insights and metrics for ruve-ngrx-store-localstorage
Simple syncing between @ngrx store and local storage
npm install ruve-ngrx-store-localstorage
Typescript
Module System
Node Version
NPM Version
TypeScript (99.42%)
Shell (0.39%)
JavaScript (0.19%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
618 Stars
271 Commits
121 Forks
21 Watchers
8 Branches
36 Contributors
Updated on Jun 25, 2025
Latest Version
5.0.1
Package Id
ruve-ngrx-store-localstorage@5.0.1
Unpacked Size
60.92 kB
Size
15.69 kB
File Count
22
NPM Version
5.6.0
Node Version
8.11.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Simple syncing between ngrx store and local storage.
ngrx-store-localstorage
depends on @ngrx/store and Angular 2+.
1npm install ngrx-store-localstorage --save
UPDATE FOR NGRX 4
StoreModule.forRoot
.1import { NgModule } from '@angular/core'; 2import { BrowserModule } from '@angular/platform-browser'; 3import { StoreModule, ActionReducerMap, ActionReducer, MetaReducer } from '@ngrx/store'; 4import { localStorageSync } from 'ngrx-store-localstorage'; 5import { reducers } from './reducers'; 6 7 8const reducers: ActionReducerMap<IState> = {todos, visibilityFilter}; 9 10export function localStorageSyncReducer(reducer: ActionReducer<any>): ActionReducer<any> { 11 return localStorageSync({keys: ['todos']})(reducer); 12} 13const metaReducers: Array<MetaReducer<any, any>> = [localStorageSyncReducer]; 14 15@NgModule({ 16 imports: [ 17 BrowserModule, 18 StoreModule.forRoot( 19 reducers, 20 {metaReducers} 21 ) 22 ] 23}) 24export class MyAppModule {}
localStorageSync(config: LocalStorageConfig): Reducer
Provide state (reducer) keys to sync with local storage. Returns a meta-reducer.
config
An object that matches with the LocalStorageConfig
interface, keys
is the only required property.An interface defining the configuration attributes to bootstrap localStorageSync
. The following are properties which compose LocalStorageConfig
:
keys
(required) State keys to sync with local storage. The keys can be defined in two different formats:
string[]
: Array of strings representing the state (reducer) keys. Full state will be synced (e.g. localStorageSync({keys: ['todos']})
).
object[]
: Array of objects where for each object the key represents the state key and the value represents custom serialize/deserialize options. This can be one of the following:
An array of properties which should be synced. This allows for the partial state sync (e.g. localStorageSync({keys: [{todos: ['name', 'status'] }, ... ]})
).
A reviver function as specified in the JSON.parse documentation.
An object with properties that specify one or more of the following:
serialize: A function that takes a state object and returns a plain json object to pass to json.stringify.
deserialize: A function that takes that takes the raw JSON from JSON.parse and builds a state object.
replacer: A replacer function as specified in the JSON.stringify documentation.
space: The space value to pass JSON.stringify.
reviver: A reviver function as specified in the JSON.parse documentation.
filter: An array of properties which should be synced (same format as the stand-alone array specified above).
rehydrate
(optional) boolean
: Pull initial state from local storage on startup, this will default to false
.
storage
(optional) Storage
: Specify an object that conforms to the Storage interface to use, this will default to localStorage
.
removeOnUndefined
(optional) boolean
: Specify if the state is removed from the storage when the new value is undefined, this will default to false
.
storageKeySerializer
(optional) (key: string) => string
: Сustom serialize function for storage keys, used to avoid Storage conflicts.
restoreDates
(boolean? = true): Restore serialized date objects. If you work directly with ISO date strings, set this option to false
.
Usage: localStorageSync({keys: ['todos', 'visibilityFilter'], storageKeySerializer: (key) => 'cool_' + key, ... })
. In this example Storage
will use keys cool_todos
and cool_visibilityFilter
keys to store todos
and visibilityFilter
slices of state). The key itself is used by default - (key) => key
.
localStorageSyncAndClean(keys: any[], rehydrate: boolean = false, removeOnUndefined: boolean = false): Reducer
This function is deprecated and soon will be removed, please use localStorageSync(LocalStorageConfig).
A shorthand that wraps the functionalities of localStorageSync
and asumes localStorage
as the storage.
keys
State keys to sync with local storage. The keys can be defined in two different formats:
(string[]): Array of strings representing the state (reducer) keys. Full state will be synced (e.g. localStorageSync(['todos'])
).
(object[]): Array of objects where for each object the key represents the state key and the value represents custom serialize/deserialize options. This can be one of the following:
An array of properties which should be synced. This allows for the partial state sync (e.g. localStorageSync([{todos: ['name', 'status'] }, ... ])
).
A reviver function as specified in the JSON.parse documentation.
An object with properties that specify one or more of the following:
serialize: A function that takes a state object and returns a plain json object to pass to json.stringify.
deserialize: A function that takes that takes the raw JSON from JSON.parse and builds a state object.
replacer: A replacer function as specified in the JSON.stringify documentation.
space: The space value to pass JSON.stringify.
reviver: A reviver function as specified in the JSON.parse documentation.
filter: An array of properties which should be synced (same format as the stand-along array specified above).
rehydrateState
(boolean? = false): Pull initial state from local storage on startup.removeOnUndefined
(boolean? = false): Specify if the state is removed from the storage when the new value is undefined.No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 8
Reason
Found 7/13 approved changesets -- score normalized to 5
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
31 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More