Socket
Socket
Sign inDemoInstall

csv-parse

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-parse - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

51

lib/index.js

@@ -229,3 +229,3 @@ // Generated by CoffeeScript 1.10.0

Parser.prototype.__write = function(chars, end, callback) {
var acceptedLength, areNextCharsDelimiter, areNextCharsRowDelimiters, auto_parse, char, escapeIsQuote, i, isDelimiter, isEscape, isNextCharAComment, isQuote, isRowDelimiter, is_float, is_int, l, ltrim, nextCharPos, ref, results, rowDelimiter, rowDelimiterLength, rtrim, wasCommenting;
var areNextCharsDelimiter, areNextCharsRowDelimiters, auto_parse, char, escapeIsQuote, i, isDelimiter, isEscape, isNextCharAComment, isQuote, isRowDelimiter, is_float, is_int, l, ltrim, nextCharPos, ref, results, rowDelimiter, rowDelimiterLength, rtrim, wasCommenting;
is_int = (function(_this) {

@@ -275,13 +275,23 @@ return function(value) {

while (i < l) {
acceptedLength = rowDelimiterLength + this.options.comment.length + this.options.escape.length + this.options.delimiter.length;
if (this.quoting) {
acceptedLength += this.options.quote.length;
if (!end) {
if (!this.commenting && l - i < this.options.comment.length && this.options.comment.substr(0, l - i) === chars.substr(i, l - i)) {
break;
}
if (this.options.rowDelimiter && l - i < rowDelimiterLength && this.options.rowDelimiter.substr(0, l - i) === chars.substr(i, l - i)) {
break;
}
if (this.options.rowDelimiter && this.quoting && l - i < (this.options.quote.length + rowDelimiterLength) && (this.options.quote + this.options.rowDelimiter).substr(0, l - i) === chars.substr(i, l - i)) {
break;
}
if (l - i <= this.options.delimiter.length && this.options.delimiter.substr(0, l - i) === chars.substr(i, l - i)) {
break;
}
if (l - i <= this.options.escape.length && this.options.escape.substr(0, l - i) === chars.substr(i, l - i)) {
break;
}
}
if (!end && (i + acceptedLength >= l)) {
break;
}
char = this.nextChar ? this.nextChar : chars.charAt(i);
this.nextChar = chars.charAt(i + 1);
if (this.options.rowDelimiter == null) {
if ((this.field === '') && (char === '\n' || char === '\r')) {
if ((!this.quoting) && (char === '\n' || char === '\r')) {
rowDelimiter = char;

@@ -332,2 +342,3 @@ nextCharPos = i + 1;

this.line.push(auto_parse(this.field));
this.field = '';
}

@@ -395,3 +406,2 @@ continue;

}
this.line.push(auto_parse(this.field));
}

@@ -402,5 +412,2 @@ i++;

i++;
if (end && i === l) {
this.line.push(auto_parse(this.field));
}
} else {

@@ -416,2 +423,22 @@ i++;

}
if (end) {
if (rtrim) {
if (!this.closingQuote) {
this.field = this.field.trimRight();
}
}
if (this.field !== '') {
this.line.push(auto_parse(this.field));
this.field = '';
}
if (this.field.length > this.options.max_limit_on_data_read) {
throw Error("Delimter not found in the file " + (JSON.stringify(this.options.delimiter)));
}
if (l === 0) {
this.lines++;
}
if (this.line.length > this.options.max_limit_on_data_read) {
throw Error("Row delimter not found in the file " + (JSON.stringify(this.options.rowDelimiter)));
}
}
this.buf = '';

@@ -418,0 +445,0 @@ results = [];

{
"version": "1.1.1",
"version": "1.1.2",
"name": "csv-parse",

@@ -4,0 +4,0 @@ "description": "CSV parsing implementing the Node.js `stream.Transform` API",

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