Snippet format update
To match the starter (for the migration)
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
### JSONtoCSV
|
||||
---
|
||||
title: JSONtoCSV
|
||||
tags: array,string,object,advanced
|
||||
---
|
||||
|
||||
Converts an array of objects to a comma-separated values (CSV) string that contains only the `columns` specified.
|
||||
|
||||
@ -23,4 +26,4 @@ const JSONtoCSV = (arr, columns, delimiter = ',') =>
|
||||
```js
|
||||
JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b']); // 'a,b\n"1","2"\n"3","4"\n"6",""\n"","7"'
|
||||
JSONtoCSV([{ a: 1, b: 2 }, { a: 3, b: 4, c: 5 }, { a: 6 }, { b: 7 }], ['a', 'b'], ';'); // 'a;b\n"1";"2"\n"3";"4"\n"6";""\n"";"7"'
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user