Fix for #4119 - any object based column will be exported with the comma types correctly encapsulated.

This commit is contained in:
mike12345567 2022-02-08 14:34:52 +00:00
parent 36bd285093
commit 55b380c3c5
2 changed files with 854 additions and 18 deletions

View File

@ -5,8 +5,11 @@ exports.csv = function (headers, rows) {
csv = `${csv}\n${headers
.map(header => {
let val = row[header]
val = typeof val === "object" ? JSON.stringify(val) : val
return `"${val}"`.trim()
val =
typeof val === "object"
? `"${JSON.stringify(val).replace(/"/g, "'")}"`
: `"${val}"`
return val.trim()
})
.join(",")}`
}

File diff suppressed because it is too large Load Diff