Skip to content

Instantly share code, notes, and snippets.

@jetstreamin
Created July 29, 2016 01:38
Show Gist options
  • Select an option

  • Save jetstreamin/36d81038c3cb536e364c24bf1a8ec65a to your computer and use it in GitHub Desktop.

Select an option

Save jetstreamin/36d81038c3cb536e364c24bf1a8ec65a to your computer and use it in GitHub Desktop.
this script parses the last, first and middle initial from a single column in a csv file. It uses fast-csv and parse-full-name to do so.
const fs = require("fs");
var csv = require("fast-csv");
var parser = require("parse-full-name").parseFullName;
fs.createReadStream("mydata.csv")
.pipe(csv())
.on("data", function(data){
name = parser(data[0]);
console.log(name.last + ',' + name.first + ',' + name.middle + ',');
})
.on("end", function(){
console.log("done");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment