Socket
Socket
Sign inDemoInstall

csv-stringify

Package Overview
Dependencies
1
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.1.1 to 5.1.2

samples/option.delimiter_multiple.js

8

CHANGELOG.md
# Changelog
## Version 5.1.2
Fix:
* write: immutable input chunks
## Version 5.1.1

@@ -8,3 +14,3 @@

* ts: add casting context missing type
* ts: add casting context missing type

@@ -11,0 +17,0 @@ ## Version 5.1.0

33

lib/es5/index.js

@@ -395,7 +395,7 @@ "use strict";

key: "stringify",
value: function stringify(record) {
var _record, column, columns, containsEscape, containsQuote, containsRowDelimiter, containsdelimiter, delimiter, err, escape, field, header, i, j, l, len, m, newrecord, quote, quoted, quotedMatch, quotedString, ref, ref1, regexp, shouldQuote, value;
value: function stringify(chunk) {
var column, columns, containsEscape, containsQuote, containsRowDelimiter, containsdelimiter, delimiter, err, escape, field, header, i, j, l, len, m, newrecord, quote, quoted, quotedMatch, quotedString, record, ref, ref1, regexp, shouldQuote, value;
if (_typeof(record) !== 'object') {
return record;
if (_typeof(chunk) !== 'object') {
return chunk;
}

@@ -409,14 +409,14 @@

escape = _this$options.escape;
record = []; // Record is an array
// Record is an array
if (Array.isArray(record)) {
if (Array.isArray(chunk)) {
if (columns) {
// We are getting an array but the user has specified output columns. In
// this case, we respect the columns indexes
record.splice(columns.length);
chunk.splice(columns.length);
} // Cast record elements
for (i = j = 0, len = record.length; j < len; i = ++j) {
field = record[i];
for (i = j = 0, len = chunk.length; j < len; i = ++j) {
field = chunk[i];

@@ -444,7 +444,5 @@ var _this$__cast = this.__cast(field, {

// Record is a literal object
_record = [];
if (columns) {
for (i = l = 0, ref = columns.length; 0 <= ref ? l < ref : l > ref; i = 0 <= ref ? ++l : --l) {
field = get(record, columns[i].key);
field = get(chunk, columns[i].key);

@@ -468,7 +466,7 @@ var _this$__cast3 = this.__cast(field, {

_record[i] = [value, field];
record[i] = [value, field];
}
} else {
for (column in record) {
field = record[column];
for (column in chunk) {
field = chunk[column];

@@ -492,8 +490,5 @@ var _this$__cast5 = this.__cast(field, {

_record.push([value, field]);
record.push([value, field]);
}
}
record = _record;
_record = null;
}

@@ -500,0 +495,0 @@

@@ -309,18 +309,19 @@ // Generated by CoffeeScript 2.3.2

// Convert a line to a string. Line may be an object, an array or a string.
stringify(record) {
var _record, column, columns, containsEscape, containsQuote, containsRowDelimiter, containsdelimiter, delimiter, err, escape, field, header, i, j, l, len, m, newrecord, quote, quoted, quotedMatch, quotedString, ref, ref1, regexp, shouldQuote, value;
if (typeof record !== 'object') {
return record;
stringify(chunk) {
var column, columns, containsEscape, containsQuote, containsRowDelimiter, containsdelimiter, delimiter, err, escape, field, header, i, j, l, len, m, newrecord, quote, quoted, quotedMatch, quotedString, record, ref, ref1, regexp, shouldQuote, value;
if (typeof chunk !== 'object') {
return chunk;
}
({columns, delimiter, header, quote, escape} = this.options);
record = [];
// Record is an array
if (Array.isArray(record)) {
if (Array.isArray(chunk)) {
if (columns) {
// We are getting an array but the user has specified output columns. In
// this case, we respect the columns indexes
record.splice(columns.length);
chunk.splice(columns.length);
}
// Cast record elements
for (i = j = 0, len = record.length; j < len; i = ++j) {
field = record[i];
for (i = j = 0, len = chunk.length; j < len; i = ++j) {
field = chunk[i];
[err, value] = this.__cast(field, {

@@ -340,6 +341,5 @@ index: i,

// Record is a literal object
_record = [];
if (columns) {
for (i = l = 0, ref = columns.length; (0 <= ref ? l < ref : l > ref); i = 0 <= ref ? ++l : --l) {
field = get(record, columns[i].key);
field = get(chunk, columns[i].key);
[err, value] = this.__cast(field, {

@@ -355,7 +355,7 @@ index: i,

}
_record[i] = [value, field];
record[i] = [value, field];
}
} else {
for (column in record) {
field = record[column];
for (column in chunk) {
field = chunk[column];
[err, value] = this.__cast(field, {

@@ -371,7 +371,5 @@ index: i,

}
_record.push([value, field]);
record.push([value, field]);
}
}
record = _record;
_record = null;
}

@@ -378,0 +376,0 @@ if (Array.isArray(record)) {

{
"version": "5.1.1",
"version": "5.1.2",
"name": "csv-stringify",

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

@@ -26,3 +26,3 @@

* to be used conjointly with `csv-generate`, `csv-parse` and `stream-transform`
* BSD License
* MIT License

@@ -29,0 +29,0 @@ ## Usage

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc