javascript unpacking an object?
<p>coming from clojure I need to write some javascript functions</p>

<p>Lets say I have a function that acts on some spec object.. I want to refer to the variables in spec in a local scope without having to write spec.container, spec.nrow, spec.ncol. It seems there is no native support for destructuring, is this correct? If so
how would I write an unpack (depth 1) function as below? - I don't really want to use eval in it either.</p>

<pre><code>var spec = {container: {width: 900, height: 600}, nrow: 4, ncol: 5, vgap: "5px"}

function grid(spec) {
   // bad..
   var width = spec.container.width;
   var height = spec.container.height;
   var nrow = spec.nrow;
   etc...

   // I would prefer to write this, then have local access to nrow, width, height, etc
   unpack(spec);
   unpack(container);
}
</code></pre>

<p>Thanks</p>
