Skip to content

Instantly share code, notes, and snippets.

View davenewham's full-sized avatar
🐢
being a turtle

David Newham davenewham

🐢
being a turtle
View GitHub Profile
@pwfcurry
pwfcurry / sainsbury-receipt.js
Created October 20, 2020 09:24
Converts Sainsbury json receipt to csv
// node <this file.js> <sainsbury json receipt>
const fs = require("fs");
const file = process.argv[2];
const data = JSON.parse(fs.readFileSync(file, { encoding: "utf8", flag: "r" }));
console.log("name,qty,total");
data.order_items.map(item => {
const name = item.product.name.replace(",", "");