mafintosh / csv-parser

Streaming csv parser inspired by binary-csv that aims to be faster than everyone else
MIT License
1.41k stars 134 forks source link

Export CsvParser class so that it can be extended #152

Closed pkese closed 4 years ago

pkese commented 4 years ago

Feature Proposal

The csv-parse file ends with exporting

module.exports = (opts) => new CsvParser(opts)

This prohibits a user to access the CsvParser class and extend its functionality using inheritance.

I'd suggest to export the class as well:

module.exports = (opts) => new CsvParser(opts)
module.exports.CsvParserClass = CsvParser

Feature Use Case

This would allow people to override parser behaviour by inheriting and extending the class (e.g. override the writeRow method - related to #149).

shellscape commented 4 years ago

Novel idea, but a fork or transform stream is still more appropriate for this project. This isn't postcss where several mainstream variations and extensions on CSS exist with widespread adoption. In situations like that, extensibility makes sense. Since this project mainly operates on the premise of streams and output via streams, extending the writeRow method can be accomplished by manipulating the stream.

Apologies for closing after the first comment on this and #149, but it's just not something I'm willing to entertain at the moment.

pkese commented 4 years ago

No problem. Thanks.