Skip to content

Commit f0378dc

Browse files
committed
fix: update to pass all tests
1 parent 5c7cbba commit f0378dc

File tree

4 files changed

+154
-333
lines changed

4 files changed

+154
-333
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<br/><br/><br/><br/><br/><br/><br/>
55
<h1>CSV-Rex</h1>
66
<p>A tiny and fast CSV parser & formatter for JavaScript.</p>
7-
<p>It's small hands are a feature.</p>
87
<br />
98
<p>
109
<a href="https://www.npmjs.com/package/csv-rex?activeTab=versions">
@@ -36,7 +35,7 @@
3635
## Features
3736
- Free to use under MIT licence
3837
- Comma-Separated Values (CSV) Files specification compliant ([RFC-4180](https://tools.ietf.org/html/rfc4180))
39-
- Small bundle size (0.5KB - 1KB compressed)
38+
- Small bundle size (~1KB compressed)
4039
- Zero dependencies
4140
- ESM & CJS modules with `.map` files
4241
- NodeJS and WebStream API support via @datastream/csv
@@ -83,18 +82,17 @@ Defaults are set to for performance and RFC-4180 compliance.
8382
- `true`: First row of the `input` is the headers and will need to be pulled out
8483
- `[...]`: Pre-assign headers because `input` contains no headers.
8584
- `false`: Don't map to JSON, return array of values instead.
86-
- `newlineChar` (`\n`): What `newline` character(s) to be used.
87-
- `delimiterChar` (`,`): Characters used to separate fields
85+
- `newlineChar` (`\r\n`): What `newline` character(s) to be used.
86+
- `delimiterChar` (`,`): Characters used to separate fields. Must be length of 1
8887
- `quoteChar` (`"`): Character used to wrap fields that need to have special characters within them. Must be length of 1
8988
- `escapeChar` (`quoteChar`): Character used to escape the `quoteChar`. Must be length of 1
9089
9190
### Parse
9291
- `enqueue` (`({data, idx, err}) => {}`): Function to run on parsed row data.
9392
- `chunkSize` (`10MB`): Size of chunks to process at once. Should be greater than the size of the 3 largest lines.
94-
- `fastMode` (`true`): Option to allow a faster parsing strategy when `quoteChar` is not present in a chunk.
95-
- `commentPrefixValue` (false): Lines starting with this value will be ignored (i.e. `#`, `//`). Can be set to `false` if files will never have comments.
9693
- `emptyFieldValue` (`<empty string>`): Value to be used instead of an empty string. Can be set to `undefined` to have empty fields not be included.
9794
- `coerceField` (`(field) => field`): Function to apply type/value coercion.
95+
- `commentPrefixValue` (false): Lines starting with this value will be ignored (i.e. `#`, `//`). Can be set to `false` if files will never have comments.
9896
- `errorOnEmptyLine` (`true`): When an empty line is encountered. Push row with error when occurs, row ignored otherwise.
9997
- `errorOnComment` (`true`): When a comment is encountered. Push row with error when occurs, row ignored otherwise.
10098
- `errorOnFieldsMismatch` (`true`): When number of headers does not match the number of fields in a row. Push row with error when occurs, row ignored otherwise.
@@ -274,4 +272,4 @@ export const csvParseStream = (opts) => {
274272
- [ ] Automate and publish benchmarks
275273
- [ ] option functionality
276274
- validate options
277-
- autodetect options
275+
- autodetect options (newline/delimiter)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "csv-rex",
3-
"version": "0.0.0",
3+
"version": "0.1.0",
44
"description": "A tiny and fast CSV parser for JavaScript.",
55
"type": "module",
66
"files": [

0 commit comments

Comments
 (0)