redux-devtools
Advanced tools
Comparing version 3.0.0-alpha-4 to 3.0.0-alpha-7
@@ -7,14 +7,13 @@ 'use strict'; | ||
var _devTools = require('./devTools'); | ||
var _instrument = require('./instrument'); | ||
exports['default'] = _interopRequire(_devTools); | ||
exports.ActionCreators = _devTools.ActionCreators; | ||
exports.ActionTypes = _devTools.ActionTypes; | ||
exports.instrument = _interopRequire(_instrument); | ||
exports.ActionTypes = _instrument.ActionTypes; | ||
var _DevToolsProvider = require('./DevToolsProvider'); | ||
var _persistState = require('./persistState'); | ||
exports.DevToolsProvider = _interopRequire(_DevToolsProvider); | ||
exports.persistState = _interopRequire(_persistState); | ||
var _persistState = require('./persistState'); | ||
var _createDevTools = require('./createDevTools'); | ||
exports.persistState = _interopRequire(_persistState); | ||
exports.createDevTools = _interopRequire(_createDevTools); |
@@ -9,5 +9,11 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var identity = function identity(_) { | ||
return _; | ||
}; | ||
function persistState(sessionId) { | ||
var stateDeserializer = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; | ||
var actionDeserializer = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; | ||
var deserializeState = arguments.length <= 1 || arguments[1] === undefined ? identity : arguments[1]; | ||
var deserializeAction = arguments.length <= 2 || arguments[2] === undefined ? identity : arguments[2]; | ||
@@ -22,17 +28,16 @@ if (!sessionId) { | ||
function deserializeState(fullState) { | ||
return _extends({}, fullState, { | ||
committedState: stateDeserializer(fullState.committedState), | ||
computedStates: fullState.computedStates.map(function (computedState) { | ||
return _extends({}, computedState, { | ||
state: stateDeserializer(computedState.state) | ||
}); | ||
}) | ||
}); | ||
} | ||
function deserialize(_ref) { | ||
var historyState = _ref.historyState; | ||
function deserializeActions(fullState) { | ||
return _extends({}, fullState, { | ||
stagedActions: fullState.stagedActions.map(function (action) { | ||
return actionDeserializer(action); | ||
var rest = _objectWithoutProperties(_ref, ['historyState']); | ||
return _extends({}, rest, { | ||
historyState: _extends({}, historyState, { | ||
stagedActions: historyState.stagedActions.map(deserializeAction), | ||
committedState: deserializeState(historyState.committedState), | ||
computedStates: historyState.computedStates.map(function (computedState) { | ||
return _extends({}, computedState, { | ||
state: deserializeState(computedState.state) | ||
}); | ||
}) | ||
}) | ||
@@ -42,16 +47,2 @@ }); | ||
function deserialize(fullState) { | ||
if (!fullState) { | ||
return fullState; | ||
} | ||
var deserializedState = fullState; | ||
if (typeof stateDeserializer === 'function') { | ||
deserializedState = deserializeState(deserializedState); | ||
} | ||
if (typeof actionDeserializer === 'function') { | ||
deserializedState = deserializeActions(deserializedState); | ||
} | ||
return deserializedState; | ||
} | ||
return function (next) { | ||
@@ -63,4 +54,7 @@ return function (reducer, initialState) { | ||
try { | ||
finalInitialState = deserialize(JSON.parse(localStorage.getItem(key))) || initialState; | ||
next(reducer, initialState); | ||
var json = localStorage.getItem(key); | ||
if (json) { | ||
finalInitialState = deserialize(JSON.parse(json)) || initialState; | ||
next(reducer, initialState); | ||
} | ||
} catch (e) { | ||
@@ -67,0 +61,0 @@ console.warn('Could not read debug session from localStorage:', e); |
{ | ||
"name": "redux-devtools", | ||
"version": "3.0.0-alpha-4", | ||
"version": "3.0.0-alpha-7", | ||
"description": "Redux DevTools with hot reloading and time travel", | ||
@@ -13,3 +13,3 @@ "main": "lib/index.js", | ||
"test:cov": "babel-node ./node_modules/.bin/isparta cover ./node_modules/.bin/_mocha -- --recursive", | ||
"prepublish": "npm run lint && npm run clean && npm run build" | ||
"prepublish": "npm run lint && npm run test && npm run clean && npm run build" | ||
}, | ||
@@ -16,0 +16,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27273
16
413
1