Created
November 13, 2018 02:50
-
-
Save thinkgarden/1d67256ecdc037939b050227f903ca22 to your computer and use it in GitHub Desktop.
[js object]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getIn = (state, path) => { | |
if (!state) { | |
return state | |
} | |
const length = path.length | |
if (!length) { | |
return undefined | |
} | |
let result = state | |
for (let i = 0; i < length && !!result; ++i) { | |
result = result[path[i]] | |
} | |
return result | |
} | |
const merge = (state,paylod) => ({...state, ...payload}) | |
getIn(state, ['router', 'location']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment