Skip to content

Commit 2a1dd7e

Browse files
committed
refactor: replace papaparse with csv-stringify
1 parent 0603a69 commit 2a1dd7e

File tree

3 files changed

+17
-24
lines changed

3 files changed

+17
-24
lines changed

package-lock.json

Lines changed: 8 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
},
4545
"dependencies": {
4646
"@nuxtify/core": "^0.1.8",
47+
"csv-stringify": "^6.5.2",
4748
"defu": "^6.1.4",
4849
"file-saver": "^2.0.5",
4950
"firebase": "^11.9.1",
50-
"nuxt-vuefire": "^1.0.5",
51-
"papaparse": "^5.5.3"
51+
"nuxt-vuefire": "^1.0.5"
5252
},
5353
"devDependencies": {
5454
"@nuxt/devtools": "^2.5.0",
@@ -60,7 +60,6 @@
6060
"@nuxt/test-utils": "^3.19.1",
6161
"@types/file-saver": "^2.0.7",
6262
"@types/node": "latest",
63-
"@types/papaparse": "^5.3.16",
6463
"changelogen": "^0.6.1",
6564
"eslint": "^9.29.0",
6665
"nuxt": "^3.17.5",

src/runtime/utils/io.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import saveAs from 'file-saver'
2-
import Papa from 'papaparse'
2+
import { stringify } from 'csv-stringify/browser/esm/sync'
33

4+
/**
5+
* Converts an array of data into a CSV string and initiates a download.
6+
*/
47
export function downloadCSV(data: unknown[], filename = 'export') {
58
// Convert to CSV
6-
const csv = Papa.unparse(data)
9+
const csv = stringify(data, {
10+
header: true,
11+
})
712

813
// Download File
914
const blob = new Blob([csv], {

0 commit comments

Comments
 (0)