Breaking keys into deep Javascript objects
<p>I would like to iterate through the following array, and break into objects, from:</p>

<pre><code>data = [
  {k: "a_b_c", v: 1},
  {k: "a_b_c", v: 2},
  {k: "a_b_c", v: 3},
  {k: "a_b_d", v: 1},
  {k: "a_b_d", v: 2},
  {k: "a_b_d", v: 3},
  {k: "a_c_a", v: 1},
  {k: "a_c_b", v: 2},
  {k: "a_d", v: 1},
  {k: "a_d", v: 2}
]
</code></pre>

<p>to:</p>

<pre><code>result = {
  a: {
    b: {
      c: [1,2,3],
      d: [1,2,3]
    },
    c: {
      a: [1],
      b: [2]
    },
    d: [1,2]
  },
}
</code></pre>

<p>any ideas on achieving this neatly?</p>
