title: How do I transform a List of Maps into a Map of Maps in immutable.js?
body: <p>Suppose I have an immutable.js <code>List</code> like this:</p>
  
  <pre><code>var xs = Immutable.fromJS([{key: "k", text: "foo"}])
  </code></pre>
  
  <p>I want to transform that into a Map that looks like this:</p>
  
  <pre><code>var ys = Immutable.fromJS({k: {key: "k", text: "foo"}})
  </code></pre>
  
  <p>How do I turn <code>xs</code> into <code>ys</code> idiomatically in immutable.js?</p>
  
  <p>By <em>idiomatically</em> I mean that any intermediate structures should be immutable.js structures, and I think that any intermediate steps would use <a href="https://stackoverflow.com/a/27532894/194904">iterable composition</a> instead of creating full-size intermediate representations.</p>
  
  <p><em>Edit</em>: I've created a <a href="http://jsperf.com/idiomatic-immutable-js-listofmaps-to-mapofmaps" rel="nofollow noreferrer">jsperf benchmark</a> comparing the answers provided so far. Both non-mutating solutions feel fairly idiomatic to me; I may hold out and let votes decide the chosen answer or hold out until we can gather a collection of roughly equally idiomatic techniques.</p>