code: function inferColumns(rows) {
    var columnSet = Object.create(null),
        columns = [];
  
    rows.forEach(function(row) {
      for (var column in row) {
        if (!(column in columnSet)) {
          columns.push(columnSet[column] = column);
        }
      }
    });
  
    return columns;
  }
docs: Compute unique columns in order of discovery.