Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
cnative100 authored Jul 9, 2021
1 parent d70e494 commit 1329301
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions generatepicklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Square -> Integromat -> Google Sheets -> CSV collation of order picklist

const fs = require('fs');
const readline = require('readline');

async function processLineByLine() {
const fileStream = fs.createReadStream('/Users/chrisnewman/desktop/orders.txt');

const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity
});

var map = {};

for await (const line of rl) {
if(line.trim() !== "\""){
var tokens = line.split(":");
var key = tokens[0].trim();
var value = parseInt(tokens[1].trim());

if(key in map){
map[key] = map[key]+value;
}
else{
map[key] = value;
}
}

}

console.log(map);
}

processLineByLine();

0 comments on commit 1329301

Please sign in to comment.