Travis build: 27 [custom]
This commit is contained in:
@ -59,6 +59,27 @@
|
||||
"hash": "4fa8b87ac30ec67afe40c80101a702986dd1e5cab3cd8b9653f1b7c8cbac7540"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "arrayToCSV",
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "arrayToCSV.md",
|
||||
"text": "Converts a 2D array to a comma-separated values (CSV) string.\n\nUse `Array.map()` and `String.join(delimiter)` to combine individual 1D arrays (rows) into strings.\nUse `String.join('\\n')` to combine all rows into a CSV string, separating each row with a newline.\nOmit the second argument, `delimiter` to use a default delimiter of `,`.",
|
||||
"codeBlocks": [
|
||||
"const arrayToCSV = (arr, delimiter = ',') => arr.map(v => v.join(delimiter)).join('\\n');",
|
||||
"arrayToCSV([['a', 'b'], ['c', 'd']]); // 'a,b\\nc,d'\narrayToCSV([['a', 'b'], ['c', 'd']], ';'); // 'a;b\\nc;d'"
|
||||
],
|
||||
"tags": [
|
||||
"array",
|
||||
"string",
|
||||
"utility"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"archived": false,
|
||||
"hash": "a4b4c5a8bd490da8fa4c065beb88014541bf71e7ff6a875123f297ff06bacd12"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "arrayToHtmlList",
|
||||
"type": "snippet",
|
||||
|
||||
Reference in New Issue
Block a user