From ca5332ca5691587d80a8c12a2ffb5cf49c26a9b8 Mon Sep 17 00:00:00 2001 From: donal Date: Thu, 13 Feb 2020 23:55:56 +0000 Subject: [PATCH] changing parser to remove quotes --- functions/app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functions/app.js b/functions/app.js index 90a43d4..0fef27e 100644 --- a/functions/app.js +++ b/functions/app.js @@ -6,8 +6,9 @@ const axios = require('axios'); const fm = require('front-matter'); const router = express.Router(); const { - parse + Parser } = require('json2csv'); + const bufferFrom = require('buffer-from') const BASE_API_URL = @@ -49,6 +50,11 @@ const opts = { fields }; +const json2csvParser = new Parser({ + quote: '', + fields +}); + const options = { headers: { Authorization: `token ${process.env.GITHUB_TOKEN}` @@ -114,7 +120,7 @@ router.get('/data', (req, res) => { response.push(backOfCard); }); // TODO - add parser for CSV - const csv = parse(response, opts); + const csv = json2csvParser.parse(response, opts); // console.info(csv); req.query.type == 'json' ? res.header('Content-Type', 'application/json') : res.header('Content-Type', 'text/csv');