1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-24 16:36:46 +00:00
bramw_baserow/web-frontend/modules/core/plugins/papa.js
2022-08-05 13:52:33 +00:00

17 lines
427 B
JavaScript

import Papa from 'papaparse'
export default function (context, inject) {
Papa.parsePromise = function (file, config = {}) {
return new Promise((resolve, reject) => {
Papa.parse(file, { complete: resolve, error: reject, ...config })
})
}
Papa.arrayToString = (array) => {
return Papa.unparse([array])
}
Papa.stringToArray = (str) => {
return Papa.parse(str).data[0]
}
inject('papa', Papa)
}