csv-write-stream
Advanced tools
Comparing version 0.0.3 to 0.1.0
@@ -12,2 +12,6 @@ var through = require('through2') | ||
this.newline = this.opts.newline || '\n' | ||
this.sendHeaders = this.opts.sendHeaders | ||
if (this.sendHeaders == null) { | ||
this.sendHeaders = true | ||
} | ||
this.stream = through({objectMode: true}, this.write.bind(this)) | ||
@@ -26,3 +30,3 @@ return this.stream | ||
} | ||
if (!this.sentHeaders) { | ||
if (this.sendHeaders && !this.sentHeaders) { | ||
this.stream.push(this.serialize(this.headers)) | ||
@@ -29,0 +33,0 @@ this.sentHeaders = true |
{ | ||
"name": "csv-write-stream", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "A CSV encoder stream that produces properly escaped CSVs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -53,3 +53,3 @@ # csv-write-stream | ||
// produces: hello,foo,baz\nworld,bar,taco\n | ||
// produces: hello,foo\nworld,bar\n | ||
``` | ||
@@ -56,0 +56,0 @@ |
12
test.js
@@ -100,1 +100,13 @@ var test = require('tape') | ||
}) | ||
test('no headers displayed', function(t) { | ||
var writer = csv({sendHeaders: false}) | ||
writer.pipe(concat(function(data) { | ||
t.equal('world,bar,taco\n', data.toString()) | ||
t.end() | ||
})) | ||
writer.write({hello: "world", foo: "bar", baz: "taco"}) | ||
writer.end() | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6651
136