UNPKG

test-this-package-today

Version:

Event Inc is a fully managed event bus lets you send and receive data across mission-critical cloud apps, databases and warehouses.

7 lines 680 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { csv: "function parseCSV (payload) { const [headerLine, ...dataLines] = payload.split('\\n'); const delimiter = ','; const headers = headerLine.split(delimiter); return dataLines.map((line) => { const cells = line.split(delimiter); return headers.reduce((obj, header, index) => { obj[header] = cells[index]; return obj; }, {}); }); };", json: "function parseJSON (payload) { try { const parsedPayload = JSON.parse(payload); return Object.entries(parsedPayload).map(([key, value]) => ({ key, value })); } catch (e) { return []; } };" }; //# sourceMappingURL=parsers.apis.js.map