Closed
Description
This is the example in the docs at https://facebook.github.io/immutable-js/docs/#/Map/setIn
const { Map } = require('immutable')
const originalMap = Map({
subObject: Map({
subKey: 'subvalue',
subSubObject: Map({
subSubKey: 'subSubValue'
})
})
})
const newMap = originalMap.setIn(['subObject', 'subKey'], 'ha ha!')
// Map {
// "subObject": Map {
// "subKey": "ha ha!",
// "subSubObject": Map { "subSubKey": "subSubValue" }
// }
// }
const newerMap = originalMap.setIn(
['subObject', 'subSubObject', 'subSubKey'],
'ha ha ha!'
)
// Map {
// "subObject": Map {
// "subKey": "ha ha!",
// "subSubObject": Map { "subSubKey": "ha ha ha!" }
// }
// }
The output for newerMap
should instead be:
// Map {
// "subObject": Map {
// "subKey": "subValue",
// "subSubObject": Map { "subSubKey": "ha ha ha!" }
// }
// }
The same applies for the setIn-Example for OrderedMap
Should you agree, I would make a PullRequest