Comparing version 1.0.2 to 1.0.3
@@ -7,2 +7,3 @@ var es = require('event-stream'); | ||
this.options = options || {} | ||
this.fieldSeparator = this.options.fieldSeparator || ','; | ||
} | ||
@@ -28,2 +29,3 @@ | ||
this.options = options || {} | ||
this.fieldSeparator = this.options.fieldSeparator || ','; | ||
var self = this; | ||
@@ -42,3 +44,3 @@ | ||
exporter.prototype.prepValue = function(arg, forceQuoted) { | ||
var quoted = forceQuoted || arg.indexOf('"') >= 0 || arg.indexOf(',') >= 0 || arg.indexOf('\n') >= 0 | ||
var quoted = forceQuoted || arg.indexOf('"') >= 0 || arg.indexOf(this.fieldSeparator) >= 0 || arg.indexOf('\n') >= 0 | ||
var result = arg.replace(/\"/g,'""') | ||
@@ -55,3 +57,3 @@ if (quoted) | ||
if (line) | ||
line += ',' | ||
line += this.fieldSeparator | ||
line += self.prepValue(label) | ||
@@ -69,3 +71,3 @@ return line | ||
if (line) | ||
line += ',' | ||
line += this.fieldSeparator | ||
@@ -72,0 +74,0 @@ var val = self.getValue(data, field.name) |
{ | ||
"name": "json-csv", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Export a richly structured, JSON array to CSV", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/IWSLLC/json-csv", |
@@ -54,3 +54,5 @@ json-csv | ||
} | ||
] | ||
], | ||
// use a different field separator char | ||
fieldSeparator : ';' | ||
} | ||
@@ -57,0 +59,0 @@ ``` |
Sorry, the diff of this file is not supported yet
18578
304
254