Revision 663737643064 () - Diff

Link to this snippet: https://friendpaste.com/1W51qISAkmAUZ2JG4Z0FBE
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function(head, row, req, row_info) {
csv_row = function(arr) {
return ['"' + item + '"' for each (item in arr)].join(',') + '\n';
}

if (head) {
return {
headers: { 'Content-Type': 'text/csv' },
body: csv_row(['Titel', 'URL', 'Categoriƫn', 'Tags'])
};
}
else if (row) {
doc = row.value;
return csv_row([doc.title, doc.url, doc.categories.join(','), doc.tags.join(',')]);
}
}