How to map over key-values in a map to produce another map with ImmutableJS?
<p>How, using <a href="https://facebook.github.io/immutable-js/" rel="noreferrer">ImmutableJS</a>, do I produce a new map by mapping over the key/value pairs of an input map?</p>

<p>In Scala, I would do something like this:</p>

<pre><code>scala&gt; Map(1-&gt;2, 3-&gt;4).toSeq.map{case (k, v) =&gt; (k*k) -&gt; (v*v*v)}.toMap
res1: scala.collection.immutable.Map[Int,Int] = Map(1 -&gt; 8, 9 -&gt; 64)
</code></pre>

<p>(This case trivially squares the key and cubes the value.)</p>

<p>In JavaScript, I'm hoping for something like:</p>

<pre><code>Immutable.fromJS({1: 2, 3: 4}).map((v, k) =&gt; [k*k, v*v*v]).toJS()
// { 1: 8, 9: 64 }
</code></pre>

<p>(I'm using <a href="https://babeljs.io/docs/learn-es2015/" rel="noreferrer">ES6 via Babel</a>.)</p>

<p>I realize that this isn't guaranteed to produce a defined result, due to the potential key collision. In my application I am preventing this elsewhere.</p>

<p>I'm actually using an <code>OrderedMap</code>, if that makes a difference.</p>