Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
vue-papa-parse
Advanced tools
A simple wrapper for for the original PapaParse built for VueJs. Supports both Vue 2 & Vue 3.
A simple wrapper for for the original PapaParse built for VueJs. Supports both Vue 2 & Vue 3.
npm i vue-papa-parse
# or
yarn add vue-papa-parse
import Vue from 'vue'
import VuePapaParse from 'vue-papa-parse'
Vue.use(VuePapaParse)
import { createApp } from 'vue'
import App from './App.vue'
import VuePapaParse from 'vue-papa-parse'
const app = createApp(App)
app.use(VuePapaParse)
app.mount('#app')
this.$papa.parse(csvString[, config])
read the docs for parsing csv strings
this.$papa.parse(file, config)
read the docs for parsing local files
this.$papa.parse(url, {
download: true,
// rest of config ...
})
read the docs for parsing remote files
PARSE Converts CSV to JSON
The Parse Result Object A parse result always contains three objects: data, errors, and meta. Data and errors are arrays, and meta is an object. In the step callback, the data array will only contain one element. See the parse results object docs.
The Parse Config Object The
parse
function may be passed a configuration object. It defines settings, behavior, and callbacks used during parsing. Any properties left unspecified will resort to their default values. See all config options for parse.
this.$papa.unparse(data[, config])
read the docs for unparsing data
UNPARSE Converts JSON to CSV
Papa's
unparse
utility writes out correct delimited text strings given an array of arrays or an array of objects. See all config options for unparse.
Extended Papa to include a simple download method. This allows you to easily download a .csv
file for JSON that has been converted to CSV.
This method takes two arguments:
csv
usually the the results fromthis.$papa.unparse(data[, config])
)title
The title of the downloaded .csv. note: no need to add the .csv extension.
this.$papa.download(csv, title)
Extended Papa to include a simple deduplication method. This allows you to simply remove exact duplicate entries from a parsed CSV file.
This method takes one argument:
data
usually the data key from the result object returned fromthis.$papa.parse(mixed[, config])
)
View all available PapaParse options by visiting the Official Papa docs
<template>
<button
@click="unparse"
>
Unparse Sample Data
</button>
</template>
<script>
export default {
data () {
return {
unparsedResults: null,
sampleData: [{
"Column 1": "1-1",
"Column 2": "1-2",
"Column 3": "1-3",
"Column 4": "1-4"
}, {
"Column 1": "2-1",
"Column 2": "2-2",
"Column 3": "2-3",
"Column 4": "2-4"
}, {
"Column 1": "3-1",
"Column 2": "3-2",
"Column 3": "3-3",
"Column 4": "3-4"
}, {
"Column 1": 4,
"Column 2": 5,
"Column 3": 6,
"Column 4": 7
}]
}
},
watch: {
unparsedResults (current) {
if (current) {
console.log(current)
}
}
},
methods: {
unparse () {
this.unparsedResults = this.$papa.unparse(this.sampleData, {
delimiter: ","
})
}
}
}
</script>
/*
Expected output in the console is:
1-1,1-2,1-3,1-4
2-1,2-2,2-3,2-4
3-1,3-2,3-3,3-4
4,5,6,7
*/
FAQs
A simple wrapper for for the original PapaParse built for VueJs. Supports both Vue 2 & Vue 3.
We found that vue-papa-parse demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.