Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remotedev-utils

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remotedev-utils - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

35

lib/importState.js

@@ -15,16 +15,41 @@ 'use strict';

var _jsan2 = _interopRequireDefault(_jsan);
var _serialize = require('remotedev-serialize/immutable/serialize');
var _serialize2 = _interopRequireDefault(_serialize);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function deprecate(param) {
console.warn('`' + param + '` parameter for Redux DevTools Extension is deprecated. Use `serialize` parameter instead: https://github.com/zalmoxisus/redux-devtools-extension/releases/tag/v2.12.1'); // eslint-disable-line
}
function importState(state, _ref) {
var deserializeState = _ref.deserializeState;
var deserializeAction = _ref.deserializeAction;
var serialize = _ref.serialize;
if (!state) return undefined;
var parse = _jsan2.default.parse;
if (serialize) {
if (serialize.immutable) {
parse = function parse(v) {
return _jsan2.default.parse(v, (0, _serialize2.default)(serialize.immutable, serialize.refs).reviver);
};
} else if (serialize.reviver) {
parse = function parse(v) {
return _jsan2.default.parse(v, serialize.reviver);
};
}
}
var preloadedState = void 0;
var nextLiftedState = (0, _jsan.parse)(state);
var nextLiftedState = parse(state);
if (nextLiftedState.payload) {
if (nextLiftedState.preloadedState) preloadedState = (0, _jsan.parse)(nextLiftedState.preloadedState);
nextLiftedState = (0, _jsan.parse)(nextLiftedState.payload);
if (nextLiftedState.preloadedState) preloadedState = parse(nextLiftedState.preloadedState);
nextLiftedState = parse(nextLiftedState.payload);
}
if (deserializeState) {
deprecate('deserializeState');
if (typeof nextLiftedState.computedStates !== 'undefined') {

@@ -40,4 +65,8 @@ nextLiftedState.computedStates = nextLiftedState.computedStates.map(function (computedState) {

}
if (typeof preloadedState !== 'undefined') {
preloadedState = deserializeState(preloadedState);
}
}
if (deserializeAction) {
deprecate('deserializeAction');
nextLiftedState.actionsById = (0, _mapValues2.default)(nextLiftedState.actionsById, function (liftedAction) {

@@ -44,0 +73,0 @@ return _extends({}, liftedAction, {

3

package.json
{
"name": "remotedev-utils",
"version": "0.1.1",
"version": "0.1.2",
"description": "Utils for remotedev infrastructure",

@@ -49,2 +49,3 @@ "main": "lib/index.js",

"lodash": "^4.0.0",
"remotedev-serialize": "^0.1.0",
"shortid": "^2.2.6"

@@ -51,0 +52,0 @@ },

import mapValues from 'lodash/mapValues';
import { parse } from 'jsan';
import jsan from 'jsan';
import seralizeImmutable from 'remotedev-serialize/immutable/serialize';
export default function importState(state, { deserializeState, deserializeAction }) {
function deprecate(param) {
console.warn(`\`${param}\` parameter for Redux DevTools Extension is deprecated. Use \`serialize\` parameter instead: https://github.com/zalmoxisus/redux-devtools-extension/releases/tag/v2.12.1`); // eslint-disable-line
}
export default function importState(state, { deserializeState, deserializeAction, serialize }) {
if (!state) return undefined;
let parse = jsan.parse;
if (serialize) {
if (serialize.immutable) {
parse = v => jsan.parse(v, seralizeImmutable(serialize.immutable, serialize.refs).reviver);
} else if (serialize.reviver) {
parse = v => jsan.parse(v, serialize.reviver);
}
}
let preloadedState;

@@ -13,2 +27,3 @@ let nextLiftedState = parse(state);

if (deserializeState) {
deprecate('deserializeState');
if (typeof nextLiftedState.computedStates !== 'undefined') {

@@ -23,4 +38,8 @@ nextLiftedState.computedStates = nextLiftedState.computedStates.map(computedState => ({

}
if (typeof preloadedState !== 'undefined') {
preloadedState = deserializeState(preloadedState);
}
}
if (deserializeAction) {
deprecate('deserializeAction');
nextLiftedState.actionsById = mapValues(nextLiftedState.actionsById, liftedAction => ({

@@ -33,2 +52,2 @@ ...liftedAction,

return { nextLiftedState, preloadedState };
}
}
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