How to flatten or combine member names into one list?
<p>For example if I have something like so:</p>

<pre><code>var Constants = {
  scope:{
    namespaceA: { A_X: "TEST_AX" , A_Y: "TEST_AY" },
    namespaceN: { N_X: "TEST_NX" , N_Y: "TEST_NY" }
  }
  _mapping: [],
  getMapping: function(){...}
}

var flattenList = flatten(Constants.scope); //returns ["TEST_AX","TEST_AY","TEST_NX","TEST_NY"]
var anotherWayFlattened = flatten(Constants.scope.namespaceA,Constants.scope.namespaceB); //returns same result as above
</code></pre>

<p>EDIT: one way would be to iterate over the scope via for-each loop but I was looking for something more elegent?</p>

<p>DOUBLE EDIT: ok I just whipped something up like so:</p>

<pre><code>var flattenedList = (function(list){
    var flatList = []
    $.each(list,function(i,items){
        for(var p in items) flatList.push(items[p]);
    })
    return flatList;
})([Constants.scope.namespaceA,Constants.scope.namespaceB]);
</code></pre>

<p>but was wondering if we can avoid passing in the particular property and just pass in Constants and search for  the list of namespaces</p>
