Skip to content

Commit

Permalink
remove immutable from plain wrapReducers
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelivanov committed May 25, 2018
1 parent b60e31e commit d292535
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -5,3 +5,4 @@

node_modules
lib
!src/lib
7 changes: 2 additions & 5 deletions src/lib/wrapReducers.js
@@ -1,7 +1,4 @@
import { fromJS } from 'immutable'


export default (isImmutable) => (reducers, dispatch) => {
export default (fromJS) => (reducers, dispatch) => {
const dispatchedReducers = {}

for (let nodeName in reducers) {
Expand All @@ -17,7 +14,7 @@ export default (isImmutable) => (reducers, dispatch) => {
const type = `${nodeName}.${methodName}`
const dispatchedReducer = (payload) => dispatch({
type,
payload: isImmutable ? fromJS(payload) : payload,
payload: fromJS ? fromJS(payload) : payload,
})

dispatchedReducers[nodeName][methodName] = dispatchedReducer
Expand Down
3 changes: 2 additions & 1 deletion src/structure/immutable/wrapReducers.js
@@ -1,4 +1,5 @@
import { fromJS } from 'immutable'
import wrapReducers from '../../lib/wrapReducers'


export default wrapReducers(true)
export default wrapReducers(fromJS)
2 changes: 1 addition & 1 deletion src/structure/plain/wrapReducers.js
@@ -1,4 +1,4 @@
import wrapReducers from '../../lib/wrapReducers'


export default wrapReducers(false)
export default wrapReducers()

0 comments on commit d292535

Please sign in to comment.