title: Converting a collection of objects to CSV with keys as headers and values
body: <p>I have an object <code>myObject</code> like this</p>
  
  <pre><code> 0:
      timestamp: 1525879470
      name: "testing"
      lastname: "testingdone"
   1: 
      timestamp: 1525879470
      name: "testing2"
      lastname: "testingdone2"
  </code></pre>
  
  <p>I am looking for a way to convert it to csv nicely like this</p>
  
  <pre><code>timestamp,name,lastname
  1525879470,testing,testingdone
  1525879470,testing2,testingdone2
  </code></pre>
  
  <p>Good news is I can extract the header</p>
  
  <pre><code>var headers = Object.keys(myObject.reduce(function (result, obj) {
                              return Object.assign(result, obj);
                          }, {}));
  </code></pre>
  
  <p>The headers var will give me an array of headers like</p>
  
  <p><code>Array(3): timestamp, name, lastname</code></p>
  
  <p>I am just looking to extract the values from the object maybe in an array like header, and then finally convert it into CSV as above. I tried using array map but for some reason I am not able to figure it out</p>