Skip to content

Commit 5a3a506

Browse files
committed
docs: add in format example
1 parent d7b02ab commit 5a3a506

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
- Zero dependencies
4040
- ESM & CJS modules with `.map` files
4141
- NodeJS and WebStream API support via [@datastream/csv](https://github.com/willfarrell/datastream)
42-
- Parses >250,000 rows/sec (with 10 columns on GitHub Actions). See the [benchmarks](https://github.com/willfarrell/csv-benchmarks).
42+
- It's just fast. See the [benchmarks](https://github.com/willfarrell/csv-benchmarks).
4343

4444
## Why not use `papaparse` or `csv-parse`?
4545
Both are great libraries, we've use them both in many projects over the years.
@@ -119,6 +119,13 @@ const enqueue = ({idx, data, err}) => {
119119
export default (csvString) => parse(csvString, { enqueue })
120120
```
121121

122+
### Formatting an array of objects to CSV string
123+
```javascript
124+
import { format } from 'csv-rex'
125+
126+
export default (arrayOrObjects) => parse(arrayOrObjects, { newlineChar: '\n' })
127+
```
128+
122129
### NodeJS Stream
123130
```javascript
124131
import { createReadStream } from 'node:fs'
@@ -188,11 +195,3 @@ const postMessageEncode = (str) => {
188195
postMessage(buffer, [buffer])
189196
}
190197
```
191-
192-
## Roadmap
193-
- [ ] Improve documentation
194-
- [ ] Automate and publish benchmarks
195-
- [ ] option functionality
196-
- cast fields template
197-
- validate options
198-
- autodetect options (newline/delimiter)

0 commit comments

Comments
 (0)