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

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 3.1.2 to 3.1.3

test.coffee

6

CHANGELOG.md
# Changelog
## Version 3.1.3
* rowDelimiter: fix overlap with delimiter
* internal: rename rowDelimiterLength to rowDelimiterMaxLength
## Version 3.1.2

@@ -18,3 +23,2 @@

* samples: new mixed api samples
* travis: support Node.js 10
* samples: new column script

@@ -21,0 +25,0 @@ * samples: update syntax

15

lib/es5/index.js

@@ -282,3 +282,3 @@ "use strict";

buf: '',
rowDelimiterLength: this.options.rowDelimiter ? Math.max.apply(Math, _toConsumableArray(this.options.rowDelimiter.map(function (v) {
rowDelimiterMaxLength: this.options.rowDelimiter ? Math.max.apply(Math, _toConsumableArray(this.options.rowDelimiter.map(function (v) {
return v.length;

@@ -425,3 +425,2 @@ }))) : void 0,

if (columnName === void 0 || columnName === null || columnName === false) {
// console.log('columnName', columnName)
continue;

@@ -559,5 +558,5 @@ }

if (!this.options.rowDelimiter && i + 3 > l || !this._.commenting && l - i < this.options.comment.length && this.options.comment.substr(0, l - i) === remainingBuffer || this.options.rowDelimiter && l - i < this._.rowDelimiterLength && this.options.rowDelimiter.some(function (rd) {
if (!this.options.rowDelimiter && i + 3 > l || !this._.commenting && l - i < this.options.comment.length && this.options.comment.substr(0, l - i) === remainingBuffer || this.options.rowDelimiter && l - i < this._.rowDelimiterMaxLength && this.options.rowDelimiter.some(function (rd) {
return rd.substr(0, l - i) === remainingBuffer; // Skip if the remaining buffer can be row delimiter following the closing quote
}) || this.options.rowDelimiter && this._.quoting && l - i < this.options.quote.length + this._.rowDelimiterLength && this.options.rowDelimiter.some(function (rd) {
}) || this.options.rowDelimiter && this._.quoting && l - i < this.options.quote.length + this._.rowDelimiterMaxLength && this.options.rowDelimiter.some(function (rd) {
return (_this2.options.quote + rd).substr(0, l - i) === remainingBuffer; // Skip if the remaining buffer can be delimiter

@@ -596,3 +595,3 @@ // Skip if the remaining buffer can be escape sequence

this.options.rowDelimiter = [rowDelimiter];
this._.rowDelimiterLength = rowDelimiter.length;
this._.rowDelimiterMaxLength = rowDelimiter.length;
}

@@ -753,6 +752,6 @@ } // Parse that damn char

this._.closingQuote = 0;
this._.field = null;
this._.field = null; // End of field
// Ensure that the delimiter doesnt match as well the rowDelimiter
if (isDelimiter) {
// End of field
if (isDelimiter && !isRowDelimiter) {
i += this.options.delimiter.length;

@@ -759,0 +758,0 @@ this._.nextChar = chars.charAt(i);

@@ -223,3 +223,3 @@ // Generated by CoffeeScript 2.3.2

buf: '',
rowDelimiterLength: this.options.rowDelimiter ? Math.max(...this.options.rowDelimiter.map(function(v) {
rowDelimiterMaxLength: this.options.rowDelimiter ? Math.max(...this.options.rowDelimiter.map(function(v) {
return v.length;

@@ -346,3 +346,2 @@ })) : void 0,

if (columnName === void 0 || columnName === null || columnName === false) {
// console.log('columnName', columnName)
continue;

@@ -453,6 +452,6 @@ }

// Skip if the remaining buffer can be row delimiter
if ((!this.options.rowDelimiter && i + 3 > l) || (!this._.commenting && l - i < this.options.comment.length && this.options.comment.substr(0, l - i) === remainingBuffer) || (this.options.rowDelimiter && l - i < this._.rowDelimiterLength && this.options.rowDelimiter.some(function(rd) {
if ((!this.options.rowDelimiter && i + 3 > l) || (!this._.commenting && l - i < this.options.comment.length && this.options.comment.substr(0, l - i) === remainingBuffer) || (this.options.rowDelimiter && l - i < this._.rowDelimiterMaxLength && this.options.rowDelimiter.some(function(rd) {
return rd.substr(0, l - i) === remainingBuffer;
// Skip if the remaining buffer can be row delimiter following the closing quote
})) || (this.options.rowDelimiter && this._.quoting && l - i < (this.options.quote.length + this._.rowDelimiterLength) && this.options.rowDelimiter.some((rd) => {
})) || (this.options.rowDelimiter && this._.quoting && l - i < (this.options.quote.length + this._.rowDelimiterMaxLength) && this.options.rowDelimiter.some((rd) => {
return (this.options.quote + rd).substr(0, l - i) === remainingBuffer;

@@ -487,3 +486,3 @@ // Skip if the remaining buffer can be delimiter

this.options.rowDelimiter = [rowDelimiter];
this._.rowDelimiterLength = rowDelimiter.length;
this._.rowDelimiterMaxLength = rowDelimiter.length;
}

@@ -622,3 +621,5 @@ }

this._.field = null;
if (isDelimiter) { // End of field
// End of field
// Ensure that the delimiter doesnt match as well the rowDelimiter
if (isDelimiter && !isRowDelimiter) {
i += this.options.delimiter.length;

@@ -625,0 +626,0 @@ this._.nextChar = chars.charAt(i);

{
"version": "3.1.2",
"version": "3.1.3",
"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