Created
February 21, 2016 01:41
-
-
Save Funi1234/505d46800be01cec05c4 to your computer and use it in GitHub Desktop.
Convert Decked Builder CSV to Tapped Out Inventory Format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Funi1234 on 21/02/2016. | |
*/ | |
var csv = require('fast-csv'), | |
fs = require("fs"), | |
path = require("path"); | |
var sets = {'Zendikar' :'(ZEN)', | |
'Journey into Nyx' :'(JOU)', | |
'Khans of Tarkir' :'(KTK)', | |
'Fate Reforged' :'(FRF)', | |
'Dragons of Tarkir' :'(DTK)', | |
'Magic Origins' :'(ORI)', | |
'Battle for Zendikar' :'(BFZ)', | |
'Commander 2015' :'(C15)', | |
'Oath of the Gatewatch' :'(OGW)'}; | |
//Change Filename | |
var stream = fs.createReadStream("./MTG_Deck.csv") | |
.pipe(csv.parse({headers: true})) | |
.transform(function (row) { | |
return row["Total Qty"]+"x "+row["Card"]+" "+sets[row["Set"]]; | |
/*{ | |
id: row.id, | |
firstName: row["first_name"], | |
lastName: row["last_name"], | |
address: row.address | |
};*/ | |
}) | |
.on("readable", function () { | |
var row; | |
while (null !== (row = stream.read())) { | |
console.log(row); | |
} | |
}) | |
.on("end", process.exit); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tappedout now accepts csv