data-export-kit
v0.0.5
Published
Tiny, tree-shakeable converters: JSON↔CSV, JSON↔XLSX (pure functions, no FS).
Maintainers
Readme
data-export-kit
Pure functions for data conversion:
- JSON ↔ CSV
- JSON ↔ XLSX
No filesystem in core. Optional Node helpers are exposed under /data-export-kit/node.
Install
npm install data-export-kit// test.js
const { jsonToCsv, jsonToXlsx, xlsxToJson } = require("data-export-kit");
const rows = [
{ id: 1, name: "Alice", amount: 12500.5 },
{ id: 2, name: "Bob", amount: 980.75 },
];
console.log("🚀 Testing data-export-kit...\n");
// ---------- JSON → CSV ----------
console.log("✅ Testing JSON → CSV...");
const csv = jsonToCsv(rows);
console.log("CSV Output:", csv);
// ---------- JSON → XLSX ----------
console.log("✅ Testing JSON → XLSX...");
const xlsxBuffer = jsonToXlsx(rows, { sheetName: "Report" });
console.log("XLSX Output:", xlsxBuffer);
console.log("\n🎉 All tests passed!");