Simple helper for using dot notation with Immutable.js.
Turning
state.getIn(['path', 'to', 'value'])
into
state.getIn(dot('path.to.value')
Inspired by this issue comment.
npm install immutable-dot
// Import dependencies
import Immutable from 'immutable'
import dot from 'immutable-dot'
// Make immutable map from js object
const map = Immutable.fromJS({
path: {
to: {
value: 41
}
}
})
// Fix value with awesome new notation
map.setIn(dot('path.to.value'), 42)
Should very much work with require
as well.
No tests. Living on the edge.
There's a module for that! No, not really. But it works!