Skip to content

Instantly share code, notes, and snippets.

@sorsaffari
Last active September 14, 2018 11:03
Show Gist options
  • Save sorsaffari/aa3952915f08421549cd88b7ced772e1 to your computer and use it in GitHub Desktop.
Save sorsaffari/aa3952915f08421549cd88b7ced772e1 to your computer and use it in GitHub Desktop.
Phone Calls | Loading Data: parsing CSV
function parseDataToObjects(input) {
const items = [];
return new Promise(function(resolve, reject) {
papa.parse(
fs.createReadStream(input.dataPath + ".csv"),
{
header: true, // a Papaparse config option
step: function(result, parser) {
items.push(result.data[0]);
},
complete: function() {
resolve(items);
}
}
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment