Skip to content

Commit

Permalink
fix(csv-generate): finish called twice in node 16
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Oct 13, 2021
1 parent eb841c3 commit 3decdf1
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 552 deletions.
41 changes: 8 additions & 33 deletions packages/csv/dist/cjs/index.js
Expand Up @@ -6607,39 +6607,14 @@ Transformer.prototype._transform = function(chunk, encoding, cb){
}
};
Transformer.prototype._flush = function(cb){
this._ending = function(){
if(this.state.running === 0){
if(this.state.running === 0){
cb();
}else {
this._ending = function(){
cb();
}
};
this._ending();
};

// Transformer.prototype.__done = function(err, chunks, cb) {
// var chunk, j, len;
// this.state.running--;
// if (err) {
// return this.emit('error', err);
// }
// this.state.finished++;
// for (j = 0, len = chunks.length; j < len; j++) {
// chunk = chunks[j];
// if (typeof chunk === 'number') {
// chunk = `${chunk}`;
// }
// if ((chunk != null) && chunk !== '') {
// // We dont push empty string
// // See https://nodejs.org/api/stream.html#stream_readable_push
// this.push(chunk);
// }
// }
// if (cb) {
// cb();
// }
// if (this._ending) {
// return this._ending();
// }
// };
};
}
};
Transformer.prototype.__done = function(err, chunks, cb){
this.state.running--;
if(err){
Expand All @@ -6659,7 +6634,7 @@ Transformer.prototype.__done = function(err, chunks, cb){
if(cb){
cb();
}
if(this._ending){
if(this._ending && this.state.running === 0){
this._ending();
}
};
Expand Down
41 changes: 8 additions & 33 deletions packages/csv/dist/cjs/sync.js
Expand Up @@ -7131,39 +7131,14 @@ Transformer.prototype._transform = function(chunk, encoding, cb){
}
};
Transformer.prototype._flush = function(cb){
this._ending = function(){
if(this.state.running === 0){
if(this.state.running === 0){
cb();
}else {
this._ending = function(){
cb();
}
};
this._ending();
};

// Transformer.prototype.__done = function(err, chunks, cb) {
// var chunk, j, len;
// this.state.running--;
// if (err) {
// return this.emit('error', err);
// }
// this.state.finished++;
// for (j = 0, len = chunks.length; j < len; j++) {
// chunk = chunks[j];
// if (typeof chunk === 'number') {
// chunk = `${chunk}`;
// }
// if ((chunk != null) && chunk !== '') {
// // We dont push empty string
// // See https://nodejs.org/api/stream.html#stream_readable_push
// this.push(chunk);
// }
// }
// if (cb) {
// cb();
// }
// if (this._ending) {
// return this._ending();
// }
// };
};
}
};
Transformer.prototype.__done = function(err, chunks, cb){
this.state.running--;
if(err){
Expand All @@ -7183,7 +7158,7 @@ Transformer.prototype.__done = function(err, chunks, cb){
if(cb){
cb();
}
if(this._ending){
if(this._ending && this.state.running === 0){
this._ending();
}
};
Expand Down
41 changes: 8 additions & 33 deletions packages/csv/dist/esm/index.js
Expand Up @@ -6603,39 +6603,14 @@ Transformer.prototype._transform = function(chunk, encoding, cb){
}
};
Transformer.prototype._flush = function(cb){
this._ending = function(){
if(this.state.running === 0){
if(this.state.running === 0){
cb();
}else {
this._ending = function(){
cb();
}
};
this._ending();
};

// Transformer.prototype.__done = function(err, chunks, cb) {
// var chunk, j, len;
// this.state.running--;
// if (err) {
// return this.emit('error', err);
// }
// this.state.finished++;
// for (j = 0, len = chunks.length; j < len; j++) {
// chunk = chunks[j];
// if (typeof chunk === 'number') {
// chunk = `${chunk}`;
// }
// if ((chunk != null) && chunk !== '') {
// // We dont push empty string
// // See https://nodejs.org/api/stream.html#stream_readable_push
// this.push(chunk);
// }
// }
// if (cb) {
// cb();
// }
// if (this._ending) {
// return this._ending();
// }
// };
};
}
};
Transformer.prototype.__done = function(err, chunks, cb){
this.state.running--;
if(err){
Expand All @@ -6655,7 +6630,7 @@ Transformer.prototype.__done = function(err, chunks, cb){
if(cb){
cb();
}
if(this._ending){
if(this._ending && this.state.running === 0){
this._ending();
}
};
Expand Down
41 changes: 8 additions & 33 deletions packages/csv/dist/esm/sync.js
Expand Up @@ -7127,39 +7127,14 @@ Transformer.prototype._transform = function(chunk, encoding, cb){
}
};
Transformer.prototype._flush = function(cb){
this._ending = function(){
if(this.state.running === 0){
if(this.state.running === 0){
cb();
}else {
this._ending = function(){
cb();
}
};
this._ending();
};

// Transformer.prototype.__done = function(err, chunks, cb) {
// var chunk, j, len;
// this.state.running--;
// if (err) {
// return this.emit('error', err);
// }
// this.state.finished++;
// for (j = 0, len = chunks.length; j < len; j++) {
// chunk = chunks[j];
// if (typeof chunk === 'number') {
// chunk = `${chunk}`;
// }
// if ((chunk != null) && chunk !== '') {
// // We dont push empty string
// // See https://nodejs.org/api/stream.html#stream_readable_push
// this.push(chunk);
// }
// }
// if (cb) {
// cb();
// }
// if (this._ending) {
// return this._ending();
// }
// };
};
}
};
Transformer.prototype.__done = function(err, chunks, cb){
this.state.running--;
if(err){
Expand All @@ -7179,7 +7154,7 @@ Transformer.prototype.__done = function(err, chunks, cb){
if(cb){
cb();
}
if(this._ending){
if(this._ending && this.state.running === 0){
this._ending();
}
};
Expand Down
41 changes: 8 additions & 33 deletions packages/csv/dist/iife/index.js
Expand Up @@ -6606,39 +6606,14 @@ var csv = (function (exports) {
}
};
Transformer.prototype._flush = function(cb){
this._ending = function(){
if(this.state.running === 0){
if(this.state.running === 0){
cb();
}else {
this._ending = function(){
cb();
}
};
this._ending();
};

// Transformer.prototype.__done = function(err, chunks, cb) {
// var chunk, j, len;
// this.state.running--;
// if (err) {
// return this.emit('error', err);
// }
// this.state.finished++;
// for (j = 0, len = chunks.length; j < len; j++) {
// chunk = chunks[j];
// if (typeof chunk === 'number') {
// chunk = `${chunk}`;
// }
// if ((chunk != null) && chunk !== '') {
// // We dont push empty string
// // See https://nodejs.org/api/stream.html#stream_readable_push
// this.push(chunk);
// }
// }
// if (cb) {
// cb();
// }
// if (this._ending) {
// return this._ending();
// }
// };
};
}
};
Transformer.prototype.__done = function(err, chunks, cb){
this.state.running--;
if(err){
Expand All @@ -6658,7 +6633,7 @@ var csv = (function (exports) {
if(cb){
cb();
}
if(this._ending){
if(this._ending && this.state.running === 0){
this._ending();
}
};
Expand Down
41 changes: 8 additions & 33 deletions packages/csv/dist/iife/sync.js
Expand Up @@ -7130,39 +7130,14 @@ var csv = (function (exports) {
}
};
Transformer.prototype._flush = function(cb){
this._ending = function(){
if(this.state.running === 0){
if(this.state.running === 0){
cb();
}else {
this._ending = function(){
cb();
}
};
this._ending();
};

// Transformer.prototype.__done = function(err, chunks, cb) {
// var chunk, j, len;
// this.state.running--;
// if (err) {
// return this.emit('error', err);
// }
// this.state.finished++;
// for (j = 0, len = chunks.length; j < len; j++) {
// chunk = chunks[j];
// if (typeof chunk === 'number') {
// chunk = `${chunk}`;
// }
// if ((chunk != null) && chunk !== '') {
// // We dont push empty string
// // See https://nodejs.org/api/stream.html#stream_readable_push
// this.push(chunk);
// }
// }
// if (cb) {
// cb();
// }
// if (this._ending) {
// return this._ending();
// }
// };
};
}
};
Transformer.prototype.__done = function(err, chunks, cb){
this.state.running--;
if(err){
Expand All @@ -7182,7 +7157,7 @@ var csv = (function (exports) {
if(cb){
cb();
}
if(this._ending){
if(this._ending && this.state.running === 0){
this._ending();
}
};
Expand Down
41 changes: 8 additions & 33 deletions packages/csv/dist/umd/index.js
Expand Up @@ -6609,39 +6609,14 @@
}
};
Transformer.prototype._flush = function(cb){
this._ending = function(){
if(this.state.running === 0){
if(this.state.running === 0){
cb();
}else {
this._ending = function(){
cb();
}
};
this._ending();
};

// Transformer.prototype.__done = function(err, chunks, cb) {
// var chunk, j, len;
// this.state.running--;
// if (err) {
// return this.emit('error', err);
// }
// this.state.finished++;
// for (j = 0, len = chunks.length; j < len; j++) {
// chunk = chunks[j];
// if (typeof chunk === 'number') {
// chunk = `${chunk}`;
// }
// if ((chunk != null) && chunk !== '') {
// // We dont push empty string
// // See https://nodejs.org/api/stream.html#stream_readable_push
// this.push(chunk);
// }
// }
// if (cb) {
// cb();
// }
// if (this._ending) {
// return this._ending();
// }
// };
};
}
};
Transformer.prototype.__done = function(err, chunks, cb){
this.state.running--;
if(err){
Expand All @@ -6661,7 +6636,7 @@
if(cb){
cb();
}
if(this._ending){
if(this._ending && this.state.running === 0){
this._ending();
}
};
Expand Down

0 comments on commit 3decdf1

Please sign in to comment.