Comparing version 0.0.15 to 0.0.16
@@ -77,3 +77,3 @@ // Module CSV - Copyright David Worms <open@adaltas.com> (BSD Licensed) | ||
if( csv.writeOptions.lineBreaks === null ){ | ||
csv.writeOptions.lineBreaks = "\r\n"; | ||
csv.writeOptions.lineBreaks = "\n"; | ||
} | ||
@@ -138,2 +138,5 @@ for(var i=0; i<data.length; i++){ | ||
} | ||
if(state.count === 0 && csv.writeOptions.header === true){ | ||
write(csv.writeOptions.columns || csv.readOptions.columns); | ||
} | ||
write(data, preserve); | ||
@@ -419,3 +422,3 @@ if(!transforming && !preserve){ | ||
if(line instanceof Array){ | ||
var newLine = state.countWriten ? csv.writeOptions.lineBreaks || "\r" : ''; | ||
var newLine = state.countWriten ? csv.writeOptions.lineBreaks || "\n" : ''; | ||
for(var i=0; i<line.length; i++){ | ||
@@ -422,0 +425,0 @@ var field = line[i]; |
{ | ||
"name": "csv", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "CSV parser with simple api, full of options and tested against large datasets.", | ||
@@ -5,0 +5,0 @@ "author": "David Worms <david@adaltas.com>", |
@@ -75,9 +75,9 @@ <pre> | ||
- *fromPath* | ||
- *fromPath(data, options)* | ||
Take a file path as first argument and optionally on object of options as a second arguments. | ||
- *fromStream* | ||
- *fromStream(readStream, options)* | ||
Take a readable stream as first argument and optionally on object of options as a second arguments. | ||
- *from* | ||
- *from(data, options)* | ||
Take a string, a buffer, an array or an object as first argument and optionally some options as a second arguments. | ||
@@ -116,12 +116,12 @@ | ||
- *write* | ||
- *write(data, preserve)* | ||
Take a string, an array or an object, implementation of the StreamWriter API. | ||
- *end* | ||
- *end()* | ||
Terminate the stream, implementation of the StreamWriter API. | ||
- *toPath* | ||
- *toPath(path, options)* | ||
Take a file path as first argument and optionally on object of options as a second arguments. | ||
- *toStream* | ||
- *toStream(writeStream, options)* | ||
Take a readable stream as first argument and optionally on object of options as a second arguments. | ||
@@ -150,3 +150,3 @@ | ||
- *lineBreaks* | ||
String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; default to 'auto' (discovered in source). | ||
String used to delimit record rows or a special value; special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; default to 'auto' (discovered in source or 'unix' if no source is specified). | ||
@@ -166,8 +166,10 @@ - *flags* | ||
Transforming data | ||
----------------- | ||
You may provide a callback to the `transform` method. The contract is quite simple, you receive an array of fields for each record and return the transformed record. The return value may be an array, an associative array, a string or null. If null, the record will simply be skipped. | ||
- *transform(callback)* | ||
User provided function call on each line to filter, enriche or modify the dataset. The callback is called asynchronously. | ||
The contract is quite simple, you receive an array of fields for each record and return the transformed record. The return value may be an array, an associative array, a string or null. If null, the record will simply be skipped. | ||
Unless you specify the `columns` read option, `data` are provided as arrays, otherwise they are objects with keys matching columns names. | ||
@@ -174,0 +176,0 @@ |
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
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
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
99612
106
597
260