mirror of
https://gitlab.com/bramw/baserow.git
synced 2024-11-24 16:36:46 +00:00
17 lines
427 B
JavaScript
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)
|
|
}
|