Immutable.js Push into array in nested object : <p>Assume there is an object:</p>

<pre><code>const object = {
  'foo': {
    'bar': [1, 2, 3]
  }
}
</code></pre>

<p>I need to push <code>4</code> to <code>object.foo.bar</code> array. </p>

<p>Right now I'm doing it like this:</p>

<pre><code>const initialState = Immutable.fromJS(object)
const newState = initialState.setIn(
  ['foo', 'bar', object.foo.bar.length],
  4
)
console.log(newState.toJS())
</code></pre>

<p>But I don't really like it, since I need to use <code>object.foo.bar.length</code> in the path. In my real example object is nested much deeper, and getting array's length looks very ugly. Is there another, more convenient way?</p>
