metaforecast/node_modules/json2csv/bin/utils/parseNdjson.js

12 lines
208 B
JavaScript
Raw Normal View History

2021-01-12 12:43:41 +00:00
'use strict';
function parseNdJson(input) {
return input
.split('\n')
.map(line => line.trim())
.filter(line => line !== '')
.map(line=> JSON.parse(line));
}
module.exports = parseNdJson;