This file contains 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
// 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(",", ""); |