Format snippets
This commit is contained in:
@ -16,10 +16,11 @@ const JSONtoCSV = (arr, columns, delimiter = ',') =>
|
||||
columns.join(delimiter),
|
||||
...arr.map(obj =>
|
||||
columns.reduce(
|
||||
(acc, key) => `${acc}${!acc.length ? '' : delimiter}"${!obj[key] ? '' : obj[key]}"`,
|
||||
(acc, key) =>
|
||||
`${acc}${!acc.length ? '' : delimiter}"${!obj[key] ? '' : obj[key]}"`,
|
||||
''
|
||||
)
|
||||
)
|
||||
),
|
||||
].join('\n');
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user