MCPcopy Create free account
hub / github.com/Muhammadsiddiq-code/Admin-dashboard / convertToCSV

Function convertToCSV

app.js:912–922  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

910}
911
912function convertToCSV(data) {
913 if (!data.length) return ""
914
915 const headers = Object.keys(data[0])
916 const csvContent = [
917 headers.join(","),
918 ...data.map((row) => headers.map((header) => `"${row[header]}"`).join(",")),
919 ].join("\n")
920
921 return csvContent
922}
923
924function downloadCSV(csv, filename) {
925 const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" })

Callers 1

exportDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected