swiftcsv / SwiftCSV

CSV parser for Swift
MIT License
947 stars 190 forks source link

Passing `limitTo` param from `Parser.array()` to `enumerateAsArray` #98

Closed jasonmedeiros closed 2 years ago

jasonmedeiros commented 2 years ago

Otherwise, things like CSV.init(string: String, delimiter: Character = comma, loadColumns: Bool = true) will parse the whole string when just trying to get the headers.

For large inputs, this was noticeable wasted work.

I think this was an oversight, but it does break the test testThrowsOnInvalidData. I think that test is of dubious value and just kinda incidentally worked.

DivineDominion commented 2 years ago

Thanks for bringing this up. Implemented a fix with tests for the Parser.


We've invited you to join the SwiftCSV GitHub organization – no pressure to accept! If you'd like more information on what that means, check out our contributor guidelines.