Commit Graph

10 Commits

Author SHA1 Message Date
Kenta Moriuchi
5bed4c81b5
fix(async,csv,fmt): assign default value when undefined is passed (#5893)
* 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
2024-09-03 18:57:27 +10:00
Ian Bull
9a8b3a5d4e
refactor(csv): align additional error messages (#5796)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-08-26 14:11:55 +09:00
Yusuke Tanaka
8b21698495
fix(csv): remove undefined from possible value type of parse result (#5617)
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.
2024-08-01 22:07:10 -07:00
Yusuke Tanaka
b0f2088044
docs(csv): more examples for parse and CsvParseStream (#5605)
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>
2024-08-01 21:24:15 -07:00
Yoshiya Hinosawa
dd80d82961
docs(csv): clarify CsvParseStream description (#5613) 2024-08-02 13:07:15 +09:00
Yusuke Tanaka
89770fc76a
fix(csv): show 1-based line and column numbers in error messages (#5604) 2024-08-01 08:07:52 -07:00
Yusuke Tanaka
b85d219148
feat(csv): support fieldsPerRecord in CsvParseStream (#5600)
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.
2024-08-01 03:48:14 -07:00
Asher Gomez
482d28ac11
chore(csv): remove redundant constructor examples (#5509)
chore(csv): remove constructor examples
2024-07-23 12:05:23 +09:00
Asher Gomez
ad1dad6ce6
docs(cli,csv,datetime,fmt,fs,http,ini,semver,testing): assert optional properties on types/interfaces have @default tag (#4933)
* docs: assert optional properties on types/interfaces have `@default` tag

* work

* work

* work

* work

* work

* work

* fix

* fix

* Update fs/expand_glob.ts

* cleanups

* cleanups

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-07-11 09:21:37 +00:00
Asher Gomez
dc3154c948
BREAKING(csv): remove csv from module names (#5172)
* BREAKING(csv): move modules `csv-stringify-stream` to `stringify-stream` and `csv-parse-stream` to `parse-stream`

* fix
2024-06-28 16:07:36 +10:00