Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-csv

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-csv - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

20

lib/formatter.js

@@ -5,3 +5,5 @@ var fs = require("fs"),

isUndefinedOrNull = extended.isUndefinedOrNull,
escape = extended.escape,
hash = extended.hash,
has = extended.has,
stream = require("stream"),

@@ -14,3 +16,3 @@ Transform = stream.Transform,

var delimiter = options.delimiter || ",",
ESCAPE_REGEXP = new RegExp("[" + delimiter + "\\r\\n']"),
ESCAPE_REGEXP = new RegExp("[" + delimiter + escape(options.rowDelimiter || LINE_BREAK) + "']"),
QUOTE = options.quote || '"',

@@ -55,5 +57,6 @@ ESCAPE = options.escape || '"',

var formatter = createFormatter(options),
transformer = extended.has(options, "transform") ? options.transform : defaultTransform,
hasHeaders = extended.has(options, "headers") ? options.headers : true,
transformer = has(options, "transform") ? options.transform : defaultTransform,
hasHeaders = has(options, "headers") ? options.headers : true,
rowDelimiter = options.rowDelimiter || LINE_BREAK,
includeEndRowDelimiter = !!options.includeEndRowDelimiter,
headersLength = 0,

@@ -95,2 +98,5 @@ i = -1,

writer.push(ret.join(rowDelimiter));
if (includeEndRowDelimiter) {
writer.push(rowDelimiter);
}
}

@@ -106,7 +112,8 @@ }

this.rowDelimiter = options.rowDelimiter || "\n";
var hasHeaders = this.hasHeaders = extended.has(options, "headers") ? options.headers : true;
var hasHeaders = this.hasHeaders = has(options, "headers") ? options.headers : true;
this.parsedHeaders = hasHeaders ? false : true;
this.buffer = [];
this.maxBufferSize = options.maxBuffer || 100000;
extended.has(options, "transform") && this.transform(options.transform);
this.includeEndRowDelimiter = !!options.includeEndRowDelimiter,
has(options, "transform") && this.transform(options.transform);
}

@@ -162,2 +169,5 @@

if (buffer.length) {
if (this.includeEndRowDelimiter) {
buffer.push(this.rowDelimiter);
}
transformStreamWrite.call(this, new Buffer(buffer.join("")).toString("utf8"));

@@ -164,0 +174,0 @@ buffer.length = 0;

{
"name": "fast-csv",
"version": "0.4.2",
"version": "0.4.3",
"description": "CSV parser and writer",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -220,2 +220,3 @@ [![build status](https://secure.travis-ci.org/C2FO/fast-csv.png)](http://travis-ci.org/C2FO/fast-csv)

* `rowDelimiter='\n'`: Specify an alternate row delimiter (i.e `\r\n`)
* `includeEndRowDelimiter=false`: Set to `true` to include a row delimiter at the end of the csv.

@@ -222,0 +223,0 @@ **`createWriteStream(options)`**

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc