Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
vue-json-to-csv-async
Advanced tools
A Vue.js 2 component to transform and download a json in csv format. It also accepts promises as value.
A Vue.js 2 component to transform and download a json in csv format https://github.com/nemanjagajic/vue-json-to-csv
npm install --save vue-json-to-csv-async
or yarn add vue-json-to-csv-async
For vue-cli user:
import VueJsonToCsv from 'vue-json-to-csv-async'
If you just want to use component
import VueJsonToCsv from 'vue-json-to-csv-async/src/JsonToCsv'
For standalone usage:
<script src="vue.min.js"></script>
<!-- must place this line after vue.js -->
<script src="dist/vue-json-to-csv.min.js"></script>
<script type="text/javascript">
Vue.use(VueJsonToCsv);
</script>
Simple usage: will generate a default button. The csv will include all the labels (name, surname) and the data
<vue-json-to-csv :json-data="[
{ name: 'Joe', surname: 'Roe' },
{ name: 'John', surname: 'Doe' }
]">
</vue-json-to-csv>
If you want, you can pass async function which will return an array instead of just passing plain array
<vue-json-to-csv :json-data-generator="getItemsToExport">
</vue-json-to-csv>
csv.csv
name | surname |
---|---|
Joe | Roe |
John | Doe |
Selected labels with custom csv title: will generate a custom button as defined at the slot. The csv will include only the "name" label with the "First name" title and the relevant data.
<vue-json-to-csv :json-data="[
{ name: 'Joe', surname: 'Roe' },
{ name: 'John', surname: 'Doe' }
]"
:labels="{ name: { title: 'First name' } }"
:csv-title="My_CSV"
>
<button>
<b>My custom button</b>
</button>
</vue-json-to-csv>
My_CSV.csv
First name |
---|
Joe |
John |
Handle success/error with custom button, returns specific labels with custom title: use of custom methods on success or error.
<vue-json-to-csv :json-data="[
{ name: 'John', surname: 'Doe', age: 20, salary: 20.000, hours: 37.4 },
{ name: 'John', surname: 'Roe', age: 40, salary: 40.000, hours: 35.2 },
{ name: 'Jane', surname: 'Woe', age: 50, salary: 52.000, hours: 30.4 }
]"
:labels="{
name: { title: 'First name' },
salary: { title: 'Annual salary' },
hours: { title: 'Hours/week' }
}"
@success="val => handleSuccess(val)"
@error="val => handleError(val)">
<button>
<b>My custom button</b>
</button>
</vue-json-to-csv>
Prop | Details |
---|---|
json-data | Array of the objects which contain the data to display (required). Each key will be a different column at the csv. All the objects should contain the same keys. If empty array an error will be returned. Example: [ { name: 'Joe', surname: 'Roe' }, { name: 'Joe', surname: 'Doe' }] |
show-labels | Boolean. If false the first row of the csv will not contain the labels names. |
labels | An object of the keys of the labels will be displayed. Use to filter the keys to display and modify their label title. For each key we provide the title of the key to displayed. If not defined all the keys will be parsed. Example: { name: { title: 'First name' } } |
csv-title | String. The title of the generated csv. Default: 'csv' |
separator | String. The separator of the columns. Default: ',' |
@update:error | Will be triggered in case of an empty json array, if the labels object has not children or any parsing issue |
@update:success | Will be triggered in case of a successful csv creation |
FAQs
A Vue.js 2 component to transform and download a json in csv format. It also accepts promises as value.
The npm package vue-json-to-csv-async receives a total of 66 weekly downloads. As such, vue-json-to-csv-async popularity was classified as not popular.
We found that vue-json-to-csv-async 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.