Skip to content

Commit

Permalink
added seamless-immutable updates
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyfigaro authored and supasate committed Sep 23, 2018
1 parent 8508d44 commit b5de5a7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/seamless-immutable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import createAll from './createAll'
import immutableStructure from './structure/seamless-immutable'

export const {
LOCATION_CHANGE,
CALL_HISTORY_METHOD,
push,
replace,
go,
goBack,
goForward,
routerActions,
ConnectedRouter,
connectRouter,
routerMiddleware
} = createAll(immutableStructure)
19 changes: 19 additions & 0 deletions src/structure/seamless-immutable/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SeamlessImmutable from 'seamless-immutable'
import getIn from '../plain/getIn'
import setIn from '../plain/setIn'

const { static: Immutable } = SeamlessImmutable

const structure = {
filterNotRouter: state => {
const { router, ...rest } = state // eslint-disable-line
return rest
},
fromJS: value => Immutable.from(value),
getIn,
merge: (state, payload) => Immutable.merge(state, payload),
setIn,
toJS: value => Immutable.asMutable(value)
}

export default structure

0 comments on commit b5de5a7

Please sign in to comment.