Skip to content

Commit

Permalink
[lodash] remove forEach from createPersistor (bug with lodash webpack…
Browse files Browse the repository at this point in the history
… plugin)
  • Loading branch information
rt2zz committed Nov 1, 2016
1 parent 4a16240 commit 6daad3f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/createPersistor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { KEY_PREFIX, REHYDRATE } from './constants'
import createAsyncLocalStorage from './defaults/asyncLocalStorage'
import purgeStoredState from './purgeStoredState'
import stringify from 'json-stringify-safe'
import forEach from 'lodash/forEach'

export default function createPersistor (store, config) {
// defaults
Expand Down Expand Up @@ -73,7 +72,7 @@ export default function createPersistor (store, config) {
function adhocRehydrate (incoming, options = {}) {
let state = {}
if (options.serial) {
forEach(incoming, (subState, key) => {
stateIterator(incoming, (subState, key) => {
try {
let data = deserialize(subState)
let value = transforms.reduceRight((interState, transformer) => {
Expand Down Expand Up @@ -133,7 +132,7 @@ function rehydrateAction (data) {
}

function defaultStateIterator (collection, callback) {
return forEach(collection, callback)
return Object.keys(collection).forEach((key) => callback(collection[key], key))
}

function defaultStateGetter (state, key) {
Expand Down

0 comments on commit 6daad3f

Please sign in to comment.