Can't convert Javascript array to object properly
<p>I have been struggling with this problem the entire day. I feel like it's super solvable, and I'm not sure where I'm going wrong. Each time I go to post this, I feel like I come up with a different solution that doesn't end up working.</p>

<p>I'm looking to do the following:</p>

<pre><code>var someObj = {};

// @param key - string - in the form of "foo-bar-baz" or "foo-bar". 
// (i won't know the number of segments ahead of time.)
// @param value - string - standard, don't need to act on it

function buildObject( key, value ) {

  var allKeys = key.split("-");

  // do stuff here to build someObj

}
</code></pre>

<p>Essentially the key will always take the format of key-key-key where i want to build <code>someObj[key1][key2][key3] = value</code>.</p>

<p><a href="http://jsfiddle.net/BMJjW/4/" rel="nofollow">This JSFiddle</a> contains a longer example with a sample layout of the data structure I want to walk away with.</p>

<p>Thanks so much for any help you can give.</p>
