csv-stringify
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -16,15 +16,12 @@ // Generated by CoffeeScript 1.7.1 | ||
* `columns` List of fields, applied when `transform` returns an object, order matters, read the transformer documentation for additionnal information. | ||
* `delimiter` Set the field delimiter, one character only, defaults to `options.from.delimiter` which is a comma. | ||
* `rowDelimiter` String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). | ||
* `quote` Defaults to the quote read option. | ||
* `quoted` Boolean, default to false, quote all the fields even if not required. | ||
* `eof` Add a linebreak on the last line, default to false, expect a charactere or use '\n' if value is set to "true" | ||
* `escape` Defaults to the escape read option. | ||
* `columns` List of fields, applied when `transform` returns an object, order matters, read the transformer documentation for additionnal information. | ||
* `header` Display the column names on the first line if the columns option is provided. | ||
OR create objects with properties named by header titles (when using to.array) | ||
* `lineBreaks` String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). | ||
Todo: | ||
* `eof` Add a linebreak on the last line, default to false, expect a charactere or use '\n' if value is set to "true" | ||
* `quote` Defaults to the quote read option. | ||
* `quoted` Boolean, default to false, quote all the fields even if not required. | ||
* `rowDelimiter` String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified). | ||
*/ | ||
@@ -109,2 +106,5 @@ | ||
} | ||
if (this.options.eof) { | ||
this.write(this.options.rowDelimiter); | ||
} | ||
return stream.Transform.prototype.end.apply(this, arguments); | ||
@@ -114,3 +114,3 @@ }; | ||
Stringifier.prototype.write = function(chunk, encoding, callback) { | ||
var e, preserve; | ||
var e, preserve, _base; | ||
if (chunk == null) { | ||
@@ -121,2 +121,7 @@ return; | ||
if (!preserve) { | ||
if (this.countWriten === 0 && !Array.isArray(chunk)) { | ||
if ((_base = this.options).columns == null) { | ||
_base.columns = Object.keys(chunk); | ||
} | ||
} | ||
try { | ||
@@ -123,0 +128,0 @@ this.emit('record', chunk, this.countWriten); |
{ | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"name": "csv-stringify", | ||
@@ -4,0 +4,0 @@ "description": "CSV stringifier implementing the Node.js `stream.Transform` API", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
35273
20
278