From 2db358208966766ad12b43dc6615d4d1d053c487 Mon Sep 17 00:00:00 2001 From: Thiago Ventura Date: Wed, 15 Jul 2015 11:43:23 +0100 Subject: [PATCH] line break option added --- lib/express-csv.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/express-csv.js b/lib/express-csv.js index fcc1d69..508e117 100644 --- a/lib/express-csv.js +++ b/lib/express-csv.js @@ -30,6 +30,12 @@ exports.version = package.version; exports.separator = ','; +/** + * CSV line break + */ + +exports.lineBreak = '\r\n'; + /** * Prevent Excel's casting. */ @@ -100,7 +106,7 @@ res.csv = function(obj, headers, status) { obj.forEach(function(item) { if (!(item instanceof Array)) item = objToArray(item); - body += item.map(escape).join(exports.separator) + '\r\n'; + body += item.map(escape).join(exports.separator) + exports.lineBreak; }); return this.send(body, headers, status);