kalisio/feathers-import-export

View on GitHub
lib/exporters/exporters.csv.js

Summary

Maintainability
A
0 mins
Test Coverage
F
55%
import Papa from 'papaparse'

export default {
  type () {
    return 'text/csv'
  },
  begin (info) {
    // nothig to do
  },
  process (info, data) {
    let csv
    if (info.currentChunk === 0) csv = Papa.unparse(data)
    else csv = Papa.unparse(data, { header: false })
    csv += '\n'
    return csv
  },
  end (info) {
    // nothig to do
  }
}