json2csv icon indicating copy to clipboard operation
json2csv copied to clipboard

It would be useful to be able to access the line json on each line emit

Open oliverfoster opened this issue 1 year ago • 0 comments

https://github.com/juanjoDiaz/json2csv/blob/8c7895c11321410968893519fe86a60d98269ed0/packages/plainjs/src/StreamParser.ts#L195-L201

    processedData.forEach((row) => {
      const line = this.processRow(row);
      if (line === undefined) return;
      this.onLine(line, row); // <- add row here
      this.onData(this._hasWritten ? this.opts.eol + line : line);
      this._hasWritten = true;
    });

https://github.com/juanjoDiaz/json2csv/blob/8c7895c11321410968893519fe86a60d98269ed0/packages/node/src/Transform.ts#L38

this.streamParser.onLine = (line, row) => this.emit('line', line, row); 

oliverfoster avatar Aug 19 '24 09:08 oliverfoster