I have tried to use the solution at: How to use Promises with PapaParse? to use Papa.parse with a promise, instead of using the inbuilt callback function. Unfortunately my configuration requirement is more complex than the given example as follows
Papa.parsePromise = function(file) {
return new Promise(function(complete, error) {
Papa.parse(file, {
delimiter: "",
newline: "",
download: true,
error,
complete: function(results){
var tArray=[];
var data = results.data;
var temp = data.length;
var filledRowCounter=0;
filePresentMarker=1;
for(var i=0;i<temp;i++){
var row = data[i];
if (row[0]!==""){
filledRowCounter++;
tArray.push(row);
}
}
}
});
});
};
Papa.parsePromise("Data/tables.csv")
.then(function(results) {
console.log(results);
});
The code filling tArray works fine. However, nothing is passed back to the .then function, so nothing is output to the console.log