* fix(fmt): stop using `Object.assign` for options
* fix(csv): move evaluation of option default values to later
* fix(async): change spread syntax to destructuring assignment
* lint
As we discussed in
https://github.com/denoland/std/pull/5605#discussion_r1701028684, it seems like
we never get `undefined` as a parse result of fields. If there is a mismatch in
the number of fields across rows, the parse just throws an error. To better
reflect this in typing, this commit removes `undefined` from the record value
type.
This commit adds more examples to `parse` function and `CsvParseStream` class to
cover all the provided options.
Also fixes a few other things:
- Replace stale description `ParseError` with the correct `SyntaxError`.
- Fix the default value of `comment` property. The old comment says the default
value is `#`, but this was wrong.
- Get negative value in `fieldsPerRecord` option working in `parse` as
documented
---------
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Although the constructor of `CsvParseStream` accepts `fieldsPerRecord` option
(see https://jsr.io/@std/csv@1.0.0-rc.5/doc/~/CsvParseStreamOptions) that
ensures that every record has the specified (or inferred from the first row)
number of fields, this option has no effect at all in the current
implementation. To fix this issue, this patch implements the `fieldsPerRecord`
logic in `CsvParseStream` together with sufficient amount of test cases.