1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1× 185× 5× 180× 180× 1× | import toPath from 'lodash.topath' const getInWithPath = (state, first, ...rest) => { if(!state) { return state } const next = state[first] return rest.length ? getInWithPath(next, ...rest) : next } const getIn = (state, field) => getInWithPath(state, ...toPath(field)) export default getIn |