Socket
Socket
Sign inDemoInstall

ngrx-store-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngrx-store-localstorage - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

6

dist/index.js

@@ -68,3 +68,7 @@ "use strict";

}
var raw = JSON.parse(stateSlice, reviver);
var isObjectRegex = new RegExp('\{|\\[');
var raw = stateSlice;
if (isObjectRegex.test(stateSlice.charAt(0))) {
raw = JSON.parse(stateSlice, reviver);
}
return Object.assign({}, acc, (_a = {}, _a[key] = deserialize ? deserialize(raw) : raw, _a));

@@ -71,0 +75,0 @@ }

2

package.json
{
"name": "ngrx-store-localstorage",
"version": "0.2.2",
"version": "0.2.3",
"description": "State and local storage syncing for @ngrx/store",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -18,3 +18,3 @@ # ngrx-store-localstorage

import { BrowserModule } from '@angular/platform-browser';
import { StoreModule, ActionReducerMap, ActionReducer } from '@ngrx/store';
import { StoreModule, ActionReducerMap, ActionReducer, MetaReducer } from '@ngrx/store';
import { localStorageSync } from 'ngrx-store-localstorage';

@@ -29,3 +29,3 @@ import { reducers } from './reducers';

}
const metaReducers: Array<ActionReducer<any, any>> = [localStorageSyncReducer];
const metaReducers: Array<MetaReducer<any, any>> = [localStorageSyncReducer];

@@ -32,0 +32,0 @@ @NgModule({

@@ -109,2 +109,5 @@ declare var beforeEachProviders, it, describe, expect, inject;

const primitiveStr = 'string is not an object';
const initialStatePrimitiveStr = { state: primitiveStr };
it('simple', () => {

@@ -130,2 +133,15 @@ // This tests a very simple state object syncing to mock Storage

it('simple string', () => {
const s = new MockStorage();
const skr = mockStorageKeySerializer;
syncStateUpdate(initialStatePrimitiveStr, ['state'], s, skr, false);
const raw = s.getItem('state');
expect(raw).toEqual(primitiveStr);
const finalState: any = rehydrateApplicationState(['state'], s, skr);
expect(finalState.state).toEqual(primitiveStr);
});
it('filtered', () => {

@@ -132,0 +148,0 @@ // Use the filter by field option to round-trip an object while

@@ -73,3 +73,10 @@ const INIT_ACTION = '@ngrx/store/init';

}
let raw = JSON.parse(stateSlice, reviver);
const isObjectRegex = new RegExp('\{|\\[');
let raw = stateSlice;
if (isObjectRegex.test(stateSlice.charAt(0))) {
raw = JSON.parse(stateSlice, reviver);
}
return Object.assign({}, acc, { [key]: deserialize ? deserialize(raw) : raw });

@@ -76,0 +83,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc