
function table_Data(objectDataset, callback){
	var toExport = {};
	var data = [];
	var dataset = objectDataset.dataset;
	//var headers = [];
	//var first = true;

	for (i in dataset[objectDataset.parameter]){
		
		var current = dataset[objectDataset.parameter][i];
		var toPush = [];

		//if (first){
		//	for (i in current) headers.push(i);
		//	first = false;
		//}
		
		for (i in objectDataset.headers){
			toPush.push(String(current[objectDataset.headers[i]]));
		}
		data.push(toPush);
	}
	callback({data: data, headers: objectDataset.headers.toString().replace(/&39/g, "'").split(',')});
}

module.exports = function(data, callback){

	table_Data(data, function(tableData){
		callback(tableData);
	})
}