Gathering detailed insights and metrics for ngrx-store-localstorage-replace
Gathering detailed insights and metrics for ngrx-store-localstorage-replace
Gathering detailed insights and metrics for ngrx-store-localstorage-replace
Gathering detailed insights and metrics for ngrx-store-localstorage-replace
Simple syncing between @ngrx store and local storage
npm install ngrx-store-localstorage-replace
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
0.1.5
Package Id
ngrx-store-localstorage-replace@0.1.5
Size
9.11 kB
NPM Version
3.10.3
Node Version
6.3.0
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
4
Simple syncing between ngrx store and local storage
ngrx-store-localstorage
depends on @ngrx/store and Angular 2.
1npm install ngrx-store-localstorage --save
compose
and combineReducers
from @ngrx/store
and @ngrx/core/compose
localStorageSync
function after combineReducers
, specifying the slices of state you would like to keep synced with local storage.initialState
on application bootstrap.StoreModule.provideStore
.1import { Store, StoreModule } from '@ngrx/store'; 2import { todos, visibilityFilter } from './reducers'; 3import { NgModule } from '@angular/core' 4 5@NgModule({ 6 imports: [ 7 BrowserModule, 8 StoreModule.provideStore( 9 compose( 10 localStorageSync(['todos']), 11 combineReducers 12 )({todos, visibilityFilter}) 13 ) 14 ] 15}) 16export class MyAppModule {}
localStorageSync(keys : any[], rehydrateState : boolean = false, storage: Storage = localStorage) : Reducer
Provide state (reducer) keys to sync with local storage. Optionally specify whether to rehydrate initialState
from local storage on bootstrap.
Returns a meta-reducer
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
storage
(Storage? = localStorage): Specify an object that conforms to the Storage interface to use, this will default localStorage
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